u-boot-net refactors, fixes, cleanups
Subsystems (7)
cover u-boot-net refactors, fixes, cleanups
From: Marek Behún <[email protected]>
So I wanted to solve a problem regarding MDIO bus within mvneta driver, to make it use the mvmdio DM driver instead of the non-DM MDIO bus registered during mvneta probe, and improve some other things there, and it seems like I opened a small bag from hell, which resulted in this series of refactors, fixes and cleanups in the network subsystem.
The series applies on Tom's master branch. It won't apply to u-boot-next's master nor net, those are too old.
This series was CI tested (https://github.com/u-boot/u-boot/pull/142).
Marek Behún (14):
net: mdio-uclass: fix type for phy_mode_str and phy_handle_str
net: mdio-uclass: use ARRAY_SIZE()
net: introduce helpers to get PHY ofnode from MAC
net: mdio-uclass: add wrappers for read/write/reset operations
treewide: use dm_mdio_read/write/reset() wrappers
net: phy: fix parsing wrong property
net: introduce helpers to get PHY interface mode from a device/ofnode
treewide: Rename PHY_INTERFACE_MODE_COUNT to PHY_INTERFACE_MODE_MAX
treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA
phy: Move PHY_INTERFACE_MODE_NA to the beginning of the enum
definition
net: phy: xilinx: Check interface type in ->config(), not ->probe()
net: phy: use ->is_c45 instead of is_10g_interface() bcmgenet, sun8i_emac: Don't connect PHY two times
net: phy: don't require PHY interface mode during PHY creation
board/CZ.NIC/turris_mox/turris_mox.c | 2 +- board/boundary/nitrogen6x/nitrogen6x.c | 2 +- board/freescale/corenet_ds/eth_hydra.c | 2 +- board/freescale/corenet_ds/eth_superhydra.c | 4 +- board/freescale/t104xrdb/eth.c | 4 +- board/gdsys/a38x/controlcenterdc.c | 7 +- board/gdsys/a38x/ihs_phys.c | 6 +- board/st/stm32f746-disco/stm32f746-disco.c | 13 +-- drivers/core/ofnode.c | 44 ++++++++ drivers/core/read.c | 10 ++ drivers/net/ag7xxx.c | 9 +- drivers/net/altera_tse.c | 17 +-- drivers/net/bcm6348-eth.c | 8 +- drivers/net/bcmgenet.c | 12 +- drivers/net/designware.c | 10 +- drivers/net/dwc_eth_qos.c | 40 +------ drivers/net/ethoc.c | 4 +- drivers/net/fec_mxc.c | 15 +-- drivers/net/fm/b4860.c | 8 +- drivers/net/fm/eth.c | 13 +-- drivers/net/fm/init.c | 8 +- drivers/net/fm/ls1043.c | 6 +- drivers/net/fm/ls1046.c | 8 +- drivers/net/fm/p1023.c | 4 +- drivers/net/fm/p4080.c | 6 +- drivers/net/fm/p5020.c | 6 +- drivers/net/fm/p5040.c | 6 +- drivers/net/fm/t1024.c | 4 +- drivers/net/fm/t1040.c | 4 +- drivers/net/fm/t2080.c | 6 +- drivers/net/fm/t4240.c | 6 +- drivers/net/fsl_enetc.c | 13 +-- drivers/net/ftgmac100.c | 11 +- drivers/net/higmacv300.c | 9 +- drivers/net/ldpaa_eth/ldpaa_eth.c | 28 +---- drivers/net/ldpaa_eth/ldpaa_wriop.c | 10 +- drivers/net/ldpaa_eth/ls1088a.c | 4 +- drivers/net/ldpaa_eth/ls2080a.c | 4 +- drivers/net/ldpaa_eth/lx2160a.c | 4 +- drivers/net/macb.c | 10 +- drivers/net/mdio_mux_sandbox.c | 6 +- drivers/net/mscc_eswitch/jr2_switch.c | 2 +- drivers/net/mscc_eswitch/luton_switch.c | 2 +- drivers/net/mscc_eswitch/ocelot_switch.c | 2 +- drivers/net/mscc_eswitch/serval_switch.c | 2 +- drivers/net/mscc_eswitch/servalt_switch.c | 2 +- drivers/net/mt7620-eth.c | 45 +++----- drivers/net/mtk_eth.c | 8 +- drivers/net/mvgbe.c | 7 +- drivers/net/mvneta.c | 11 +- drivers/net/mvpp2.c | 9 +- drivers/net/pch_gbe.c | 4 +- drivers/net/phy/aquantia.c | 2 +- drivers/net/phy/phy.c | 115 +++++++------------- drivers/net/phy/xilinx_gmii2rgmii.c | 14 +-- drivers/net/pic32_eth.c | 11 +- drivers/net/qe/dm_qe_uec.c | 11 +- drivers/net/ravb.c | 19 +--- drivers/net/sh_eth.c | 19 +--- drivers/net/sni_ave.c | 16 +-- drivers/net/sni_netsec.c | 10 +- drivers/net/sun8i_emac.c | 13 +-- drivers/net/sunxi_emac.c | 5 +- drivers/net/ti/am65-cpsw-nuss.c | 15 +-- drivers/net/ti/cpsw.c | 10 +- drivers/net/ti/keystone_net.c | 24 ++-- drivers/net/tsec.c | 9 +- drivers/net/xilinx_axi_emac.c | 10 +- drivers/net/zynq_gem.c | 9 +- include/_exports.h | 3 +- include/dm/ofnode.h | 27 +++++ include/dm/read.h | 36 ++++++ include/exports.h | 3 +- include/fm_eth.h | 2 +- include/miiphy.h | 31 ++++++ include/phy.h | 32 ++---- include/phy_interface.h | 11 +- include/vsc9953.h | 2 +- net/mdio-mux-uclass.c | 16 +-- net/mdio-uclass.c | 96 ++++++++-------- test/dm/mdio.c | 18 +-- test/dm/mdio_mux.c | 16 +-- 82 files changed, 469 insertions(+), 623 deletions(-)
Signature · 1 line
2.34.1
PATCH 2/14 net: mdio-uclass: use ARRAY_SIZE()
From: Marek Behún <[email protected]>
Use the ARRAY_SIZE() macro instead of hardcoding sizes of arrays in macors.
--- net/mdio-uclass.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
net/mdio-uclass.c +5 -6
@@ -16,13 +16,12 @@#include <linux/compat.h> /* DT node properties for MAC-PHY interface */ -#define PHY_MODE_STR_CNT 2 -static const char *const phy_mode_str[PHY_MODE_STR_CNT ] = { +static const char *const phy_mode_str[] = {"phy-mode" ,"phy-connection-type" }; +/* DT node properties that reference a PHY node */ -#define PHY_HANDLE_STR_CNT 3 -static const char *const phy_handle_str[PHY_HANDLE_STR_CNT ] = { +static const char *const phy_handle_str[] = {"phy-handle" ,"phy" ,"phy-device" };
@@ -149,7 +148,7 @@ static struct phy_device *dm_eth_connect_phy_handle(struct udevice *ethdev, goto out; } -for (i =0 ; i <PHY_HANDLE_STR_CNT ; i++) +for (i =0 ; i <ARRAY_SIZE (phy_handle_str); i++)if (!dev_read_phandle_with_args (ethdev, phy_handle_str[i],NULL ,0 ,0 , &phandle))break ;
@@ -199,7 +198,7 @@ struct phy_device *dm_eth_phy_connect(struct udevice *ethdev) } interface =PHY_INTERFACE_MODE_NONE ; -for (i =0 ; i <PHY_MODE_STR_CNT ; i++) { +for (i =0 ; i <ARRAY_SIZE (phy_mode_str); i++) { if_str =dev_read_string (ethdev, phy_mode_str[i]);if (if_str) { interface =phy_get_interface_by_name (if_str);
Signature · 1 line
2.34.1
PATCH 1/14 net: mdio-uclass: fix type for phy_mode_str and phy_handle_str
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
These global variables should both have type
static const char * const
--- net/mdio-uclass.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
net/mdio-uclass.c +6 -5
@@ -17,13 +17,14 @@/* DT node properties for MAC-PHY interface */ #define PHY_MODE_STR_CNT 2 -static const char *phy_mode_str[PHY_MODE_STR_CNT ] = {"phy-mode" , -"phy-connection-type" }; +static const char *const phy_mode_str[PHY_MODE_STR_CNT ] = { +"phy-mode" ,"phy-connection-type" +};/* DT node properties that reference a PHY node */ #define PHY_HANDLE_STR_CNT 3 -const char *phy_handle_str[PHY_HANDLE_STR_CNT ] = {"phy-handle" , -"phy" , -"phy-device" }; +static const char *const phy_handle_str[PHY_HANDLE_STR_CNT ] = { +"phy-handle" ,"phy" ,"phy-device" +};void dm_mdio_probe_devices (void ) {
Signature · 1 line
2.34.1
PATCH 4/14 net: mdio-uclass: add wrappers for read/write/reset operations
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
Add wrappers dm_mdio_read(), dm_mdio_write() and dm_mdio_reset() for DM MDIO's .read(), .write() and .reset() operations.
--- include/miiphy.h | 31 +++++++++++++++++++++++++++++++ net/mdio-uclass.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+)
include/miiphy.h +31 -0
@@ -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 *
net/mdio-uclass.c +31 -0
@@ -57,6 +57,37 @@ static int dm_mdio_post_bind(struct udevice *dev)return 0 ; } +int dm_mdio_read (struct udevice *mdio_dev,int addr,int devad,int reg) +{ +struct mdio_ops *ops =mdio_get_ops (mdio_dev); + +if (!ops->read) +return -ENOSYS ; + +return ops->read (mdio_dev, addr, devad, reg); +} + +int dm_mdio_write (struct udevice *mdio_dev,int addr,int devad,int reg, +u16 val) +{ +struct mdio_ops *ops =mdio_get_ops (mdio_dev); + +if (!ops->write) +return -ENOSYS ; + +return ops->write (mdio_dev, addr, devad, reg, val); +} + +int dm_mdio_reset (struct udevice *mdio_dev) +{ +struct mdio_ops *ops =mdio_get_ops (mdio_dev); + +if (!ops->reset) +return 0 ; + +return ops->reset (mdio_dev); +} +/* * Following read/write/reset functions are registered with legacy MII code. * These are called for PHY operations by upper layers and we further call the
Signature · 1 line
2.34.1
PATCH 5/14 treewide: use dm_mdio_read/write/reset() wrappers
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
Use the new dm_mdio_read/write/reset() wrappers treewide, instead of always getting and dereferencing MDIO operations structure pointer.
--- drivers/net/mdio_mux_sandbox.c | 6 ++---- net/mdio-mux-uclass.c | 16 ++++------------ net/mdio-uclass.c | 19 ++++--------------- test/dm/mdio.c | 18 +++++++++--------- test/dm/mdio_mux.c | 16 ++++++++-------- 5 files changed, 27 insertions(+), 48 deletions(-)
drivers/net/mdio_mux_sandbox.c +2 -4
@@ -20,7 +20,6 @@ struct mdio_mux_sandbox_priv {static int mdio_mux_sandbox_mark_selection (struct udevice *dev,int sel) {struct udevice *mdio; -struct mdio_ops *ops;int err;/*
@@ -30,9 +29,8 @@ static int mdio_mux_sandbox_mark_selection(struct udevice *dev, int sel) err =uclass_get_device_by_name (UCLASS_MDIO ,"mdio-test" , &mdio);if (err)return err; - ops =mdio_get_ops (mdio); -return ops->write (mdio,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , -SANDBOX_PHY_REG_CNT -1 , (u16 )sel); +return dm_mdio_write (mdio,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , +SANDBOX_PHY_REG_CNT -1 , (u16 )sel); }static int mdio_mux_sandbox_select (struct udevice *dev,int cur,int sel)
net/mdio-mux-uclass.c +4 -12
@@ -54,11 +54,6 @@ static struct udevice *mmux_get_parent_mdio(struct udevice *mux)return pdata->mdio_parent; } -static struct mdio_ops *mmux_get_mdio_parent_ops (struct udevice *mux) -{ -return mdio_get_ops (mmux_get_parent_mdio (mux)); -} -/* call driver select function before performing MDIO r/w */ static int mmux_change_sel (struct udevice *ch,bool sel) {
@@ -90,14 +85,13 @@ static int mmux_read(struct udevice *ch, int addr, int devad, {struct udevice *mux = ch->parent;struct udevice *parent_mdio =mmux_get_parent_mdio (mux); -struct mdio_ops *parent_ops =mmux_get_mdio_parent_ops (mux);int err; err =mmux_change_sel (ch, true);if (err)return err; - err = parent_ops->read (parent_mdio, addr, devad, reg); + err =dm_mdio_read (parent_mdio, addr, devad, reg);mmux_change_sel (ch, false);return err;
@@ -109,14 +103,13 @@ static int mmux_write(struct udevice *ch, int addr, int devad, {struct udevice *mux = ch->parent;struct udevice *parent_mdio =mmux_get_parent_mdio (mux); -struct mdio_ops *parent_ops =mmux_get_mdio_parent_ops (mux);int err; err =mmux_change_sel (ch, true);if (err)return err; - err = parent_ops->write (parent_mdio, addr, devad, reg, val); + err =dm_mdio_write (parent_mdio, addr, devad, reg, val);mmux_change_sel (ch, false);return err;
@@ -127,18 +120,17 @@ static int mmux_reset(struct udevice *ch) {struct udevice *mux = ch->parent;struct udevice *parent_mdio =mmux_get_parent_mdio (mux); -struct mdio_ops *parent_ops =mmux_get_mdio_parent_ops (mux);int err;/* reset is optional, if it's not implemented just exit */ -if (!parent_ops->reset) +if (!mdio_get_ops (parent_mdio)->reset)return 0 ; err =mmux_change_sel (ch, true);if (err)return err; - err = parent_ops->reset (parent_mdio); + err =dm_mdio_reset (parent_mdio);mmux_change_sel (ch, false);return err;
net/mdio-uclass.c +4 -15
@@ -95,27 +95,18 @@ int dm_mdio_reset(struct udevice *mdio_dev)*/ static int mdio_read (struct mii_dev *mii_bus,int addr,int devad,int reg) { -struct udevice *dev = mii_bus->priv; - -return mdio_get_ops (dev)->read (dev, addr, devad, reg); +return dm_mdio_read (mii_bus->priv, addr, devad, reg); }static int mdio_write (struct mii_dev *mii_bus,int addr,int devad,int reg,u16 val) { -struct udevice *dev = mii_bus->priv; - -return mdio_get_ops (dev)->write (dev, addr, devad, reg, val); +return dm_mdio_write (mii_bus->priv, addr, devad, reg, val); }static int mdio_reset (struct mii_dev *mii_bus) { -struct udevice *dev = mii_bus->priv; - -if (mdio_get_ops (dev)->reset) -return mdio_get_ops (dev)->reset (dev); -else -return 0 ; +return dm_mdio_reset (mii_bus->priv); }static int dm_mdio_post_probe (struct udevice *dev)
@@ -135,10 +126,8 @@ static int dm_mdio_post_probe(struct udevice *dev)static int dm_mdio_pre_remove (struct udevice *dev) {struct mdio_perdev_priv *pdata =dev_get_uclass_priv (dev); -struct mdio_ops *ops =mdio_get_ops (dev); -if (ops->reset) - ops->reset (dev); +dm_mdio_reset (dev);mdio_unregister (pdata->mii_bus);mdio_free (pdata->mii_bus);
test/dm/mdio.c +9 -9
@@ -38,18 +38,18 @@ static int dm_test_mdio(struct unit_test_state *uts)ut_assertnonnull (ops->read);ut_assertnonnull (ops->write); -ut_assertok (ops->write (dev,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , -SANDBOX_PHY_REG ,TEST_REG_VALUE )); - reg = ops->read (dev,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , -SANDBOX_PHY_REG ); +ut_assertok (dm_mdio_write (dev,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , +SANDBOX_PHY_REG ,TEST_REG_VALUE )); + reg =dm_mdio_read (dev,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , +SANDBOX_PHY_REG );ut_asserteq (reg,TEST_REG_VALUE ); -ut_assert (ops->read (dev,SANDBOX_PHY_ADDR +1 ,MDIO_DEVAD_NONE , -SANDBOX_PHY_REG ) !=0 ); +ut_assert (dm_mdio_read (dev,SANDBOX_PHY_ADDR +1 ,MDIO_DEVAD_NONE , +SANDBOX_PHY_REG ) !=0 ); -ut_assertok (ops->reset (dev)); - reg = ops->read (dev,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , -SANDBOX_PHY_REG ); +ut_assertok (dm_mdio_reset (dev)); + reg =dm_mdio_read (dev,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , +SANDBOX_PHY_REG );ut_asserteq (reg,0 );return 0 ;
test/dm/mdio_mux.c +8 -8
@@ -57,22 +57,22 @@ static int dm_test_mdio_mux(struct unit_test_state *uts)* is selected to the selection #. Just reading that register from * either of the child buses should return the id of the child bus */ - reg = ops->read (mdio_ch0,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , -SANDBOX_PHY_REG_CNT -1 ); + reg =dm_mdio_read (mdio_ch0,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , +SANDBOX_PHY_REG_CNT -1 );ut_asserteq (reg,0 ); - reg = ops->read (mdio_ch1,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , -SANDBOX_PHY_REG_CNT -1 ); + reg =dm_mdio_read (mdio_ch1,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , +SANDBOX_PHY_REG_CNT -1 );ut_asserteq (reg,1 ); mmops->select (mux,MDIO_MUX_SELECT_NONE ,5 ); - reg = ops_parent->read (mdio,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , -SANDBOX_PHY_REG_CNT -1 ); + reg =dm_mdio_read (mdio,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , +SANDBOX_PHY_REG_CNT -1 );ut_asserteq (reg,5 ); mmops->deselect (mux,5 ); - reg = ops_parent->read (mdio,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , -SANDBOX_PHY_REG_CNT -1 ); + reg =dm_mdio_read (mdio,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , +SANDBOX_PHY_REG_CNT -1 );ut_asserteq (reg, (u16 )MDIO_MUX_SELECT_NONE );return 0 ;
Signature · 1 line
2.34.1
PATCH 6/14 net: phy: fix parsing wrong property
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
The "phy-interface-type" property should be "phy-connection-type".
--- drivers/net/phy/phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy.c +1 -1
@@ -989,7 +989,7 @@ struct phy_device *fixed_phy_create(ofnode node) if_str =ofnode_read_string (node,"phy-mode" );if (!if_str) { - if_str =ofnode_read_string (node,"phy-interface-type" ); + if_str =ofnode_read_string (node,"phy-connection-type" ); }if (if_str) { interface =phy_get_interface_by_name (if_str);
Signature · 1 line
2.34.1
PATCH 8/14 treewide: Rename PHY_INTERFACE_MODE_COUNT to PHY_INTERFACE_MODE_MAX
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
Rename constant PHY_INTERFACE_MODE_COUNT to PHY_INTERFACE_MODE_MAX to make it compatible with Linux' naming.
--- drivers/core/ofnode.c | 2 +- drivers/net/phy/aquantia.c | 2 +- include/phy_interface.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/core/ofnode.c +1 -1
@@ -1198,7 +1198,7 @@ phy_interface_t ofnode_read_phy_mode(ofnode node)if (!mode)return PHY_INTERFACE_MODE_NONE ; -for (i =0 ; i <PHY_INTERFACE_MODE_COUNT ; i++) +for (i =0 ; i <PHY_INTERFACE_MODE_MAX ; i++)if (!strcmp (mode, phy_interface_strings[i]))return i;
drivers/net/phy/aquantia.c +1 -1
@@ -305,7 +305,7 @@ struct {u16 syscfg;int cnt;u16 start_rate; -} aquantia_syscfg[PHY_INTERFACE_MODE_COUNT] = { +} aquantia_syscfg[PHY_INTERFACE_MODE_MAX] = { [PHY_INTERFACE_MODE_SGMII] = {0x04b, AQUANTIA_VND1_GSYSCFG_1G, AQUANTIA_VND1_GSTART_RATE_1G}, [PHY_INTERFACE_MODE_2500BASEX] = {0x144, AQUANTIA_VND1_GSYSCFG_2_5G,
include/phy_interface.h +1 -1
@@ -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[] = {
Signature · 1 line
2.34.1
PATCH 7/14 net: introduce helpers to get PHY interface mode from a device/ofnode
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
Add helpers ofnode_read_phy_mode() and dev_read_phy_mode() to parse the "phy-mode" / "phy-connection-type" property.
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.
--- board/st/stm32f746-disco/stm32f746-disco.c | 13 +++----- drivers/core/ofnode.c | 23 ++++++++++++++ drivers/core/read.c | 5 +++ drivers/net/ag7xxx.c | 9 ++---- drivers/net/altera_tse.c | 13 ++------ drivers/net/bcm6348-eth.c | 6 +--- drivers/net/bcmgenet.c | 10 ++---- drivers/net/designware.c | 10 ++---- drivers/net/dwc_eth_qos.c | 36 +++------------------- drivers/net/fec_mxc.c | 11 ++----- drivers/net/fm/eth.c | 13 +------- drivers/net/fsl_enetc.c | 13 +++----- drivers/net/ftgmac100.c | 11 ++----- drivers/net/higmacv300.c | 9 ++---- drivers/net/ldpaa_eth/ldpaa_eth.c | 28 +++-------------- drivers/net/macb.c | 10 ++---- drivers/net/mt7620-eth.c | 35 +++++++-------------- drivers/net/mtk_eth.c | 8 ++--- drivers/net/mvgbe.c | 7 ++--- drivers/net/mvneta.c | 11 ++----- drivers/net/mvpp2.c | 9 ++---- drivers/net/phy/phy.c | 25 ++------------- drivers/net/pic32_eth.c | 11 ++----- drivers/net/qe/dm_qe_uec.c | 11 ++----- drivers/net/ravb.c | 15 +++------ drivers/net/sh_eth.c | 15 +++------ drivers/net/sni_ave.c | 12 ++------ drivers/net/sni_netsec.c | 10 ++---- drivers/net/sun8i_emac.c | 11 ++----- drivers/net/ti/am65-cpsw-nuss.c | 15 +++------ drivers/net/ti/cpsw.c | 10 ++---- drivers/net/ti/keystone_net.c | 24 +++++++-------- drivers/net/tsec.c | 9 ++---- drivers/net/xilinx_axi_emac.c | 10 ++---- drivers/net/zynq_gem.c | 9 ++---- include/dm/ofnode.h | 13 ++++++++ include/dm/read.h | 17 ++++++++++ include/phy.h | 8 ----- net/mdio-uclass.c | 18 +---------- 39 files changed, 161 insertions(+), 372 deletions(-)
board/st/stm32f746-disco/stm32f746-disco.c +5 -8
@@ -117,16 +117,13 @@ int board_late_init(void)int board_init (void ) {#ifdef CONFIG_ETH_DESIGNWARE -const char *phy_mode; -int node; +ofnode node; - node =fdt_node_offset_by_compatible (gd->fdt_blob,0 ,"st,stm32-dwmac" ); -if (node <0 ) + node =ofnode_by_compatible (ofnode_null (),"st,stm32-dwmac" ); +if (!ofnode_valid (node))return -1 ; - phy_mode =fdt_getprop (gd->fdt_blob, node,"phy-mode" ,NULL ); - -switch (phy_get_interface_by_name (phy_mode)) { +switch (ofnode_read_phy_mode (node)) {case PHY_INTERFACE_MODE_RMII :STM32_SYSCFG ->pmc |=SYSCFG_PMC_MII_RMII_SEL ;break ;
@@ -134,7 +131,7 @@ int board_init(void)STM32_SYSCFG ->pmc &= ~SYSCFG_PMC_MII_RMII_SEL ;break ;default : - printf("PHY interface %s not supported !\n", phy_mode); + printf("Unsupported PHY interface!\n"); }#endif
drivers/core/ofnode.c +23 -0
@@ -1183,3 +1183,26 @@ ofnode ofnode_get_phy_node(ofnode node)return args.node; } + +phy_interface_t ofnode_read_phy_mode (ofnode node) +{ +const char *mode; +int i; + +assert (ofnode_valid (node)); + + mode =ofnode_read_string (node,"phy-mode" ); +if (!mode) + mode =ofnode_read_string (node,"phy-connection-type" ); + +if (!mode) +return PHY_INTERFACE_MODE_NONE ; + +for (i =0 ; i <PHY_INTERFACE_MODE_COUNT ; i++) +if (!strcmp (mode, phy_interface_strings[i])) +return i; + +debug ("%s: Invalid PHY interface '%s'\n" , __func__, mode); + +return PHY_INTERFACE_MODE_NONE ; +}
drivers/core/read.c +5 -0
@@ -403,3 +403,8 @@ ofnode dev_get_phy_node(const struct udevice *dev) {return ofnode_get_phy_node (dev_ofnode (dev)); } + +phy_interface_t dev_read_phy_mode (const struct udevice *dev) +{ +return ofnode_read_phy_mode (dev_ofnode (dev)); +}
drivers/net/ag7xxx.c +2 -7
@@ -1254,7 +1254,6 @@ static const struct eth_ops ag7xxx_eth_ops = {static int ag7xxx_eth_of_to_plat (struct udevice *dev) {struct eth_pdata *pdata =dev_get_plat (dev); -const char *phy_mode;int ret; pdata->iobase =dev_read_addr (dev);
@@ -1265,13 +1264,9 @@ static int ag7xxx_eth_of_to_plat(struct udevice *dev)if (ret <=0 )return ret; - phy_mode =fdt_getprop (gd->fdt_blob, ret,"phy-mode" ,NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }return 0 ; }
drivers/net/altera_tse.c +3 -10
@@ -676,17 +676,10 @@ static int altera_tse_probe(struct udevice *dev)static int altera_tse_of_to_plat (struct udevice *dev) {struct eth_pdata *pdata =dev_get_plat (dev); -const char *phy_mode; - - pdata->phy_interface =-1 ; - phy_mode =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"phy-mode" , -NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }return 0 ; }
drivers/net/bcm6348-eth.c +1 -5
@@ -415,7 +415,6 @@ static int bcm6348_eth_probe(struct udevice *dev)struct eth_pdata *pdata =dev_get_plat (dev);struct bcm6348_eth_priv *priv =dev_get_priv (dev);struct ofnode_phandle_args phy; -const char *phy_mode;int ret, i;/* get base address */
@@ -425,10 +424,7 @@ static int bcm6348_eth_probe(struct udevice *dev) pdata->iobase = (phys_addr_t ) priv->base;/* get phy mode */ - pdata->phy_interface =PHY_INTERFACE_MODE_NONE ; - phy_mode =dev_read_string (dev,"phy-mode" ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev);if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -ENODEV ;
drivers/net/bcmgenet.c +2 -8
@@ -690,20 +690,14 @@ static int bcmgenet_eth_of_to_plat(struct udevice *dev)struct eth_pdata *pdata =dev_get_plat (dev);struct bcmgenet_eth_priv *priv =dev_get_priv (dev);struct ofnode_phandle_args phy_node; -const char *phy_mode;int ret; pdata->iobase =dev_read_addr (dev);/* Get phy mode from DT */ - pdata->phy_interface =-1 ; - phy_mode =dev_read_string (dev,"phy-mode" ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - } ret =dev_read_phandle_with_args (dev,"phy-handle" ,NULL ,0 ,0 , &phy_node);
drivers/net/designware.c +2 -8
@@ -914,21 +914,15 @@ int designware_eth_of_to_plat(struct udevice *dev)struct dw_eth_dev *priv =dev_get_priv (dev);#endif struct eth_pdata *pdata = &dw_pdata->eth_pdata; -const char *phy_mode;#if CONFIG_IS_ENABLED (DM_GPIO )int reset_flags =GPIOD_IS_OUT ;#endif int ret =0 ; pdata->iobase =dev_read_addr (dev); - pdata->phy_interface =-1 ; - phy_mode =dev_read_string (dev,"phy-mode" ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - } pdata->max_speed =dev_read_u32_default (dev,"max-speed" ,0 );
drivers/net/dwc_eth_qos.c +4 -32
@@ -270,7 +270,7 @@ struct eqos_config {int config_mac;int config_mac_mdio;unsigned int axi_bus_width; -phy_interface_t (*interface)(struct udevice *dev); +phy_interface_t (*interface)(const struct udevice *dev);struct eqos_ops *ops; };
@@ -1729,21 +1729,7 @@ err_probe:return ret; } -static phy_interface_t eqos_get_interface_stm32 (struct udevice *dev) -{ -const char *phy_mode; -phy_interface_t interface =PHY_INTERFACE_MODE_NONE ; - -debug ("%s(dev=%p):\n" , __func__, dev); - - phy_mode =dev_read_prop (dev,"phy-mode" ,NULL ); -if (phy_mode) - interface =phy_get_interface_by_name (phy_mode); - -return interface; -} - -static phy_interface_t eqos_get_interface_tegra186 (struct udevice *dev) +static phy_interface_t eqos_get_interface_tegra186 (const struct udevice *dev) {return PHY_INTERFACE_MODE_MII ; }
@@ -1766,20 +1752,6 @@ static int eqos_probe_resources_imx(struct udevice *dev)return 0 ; } -static phy_interface_t eqos_get_interface_imx (struct udevice *dev) -{ -const char *phy_mode; -phy_interface_t interface =PHY_INTERFACE_MODE_NONE ; - -debug ("%s(dev=%p):\n" , __func__, dev); - - phy_mode =dev_read_prop (dev,"phy-mode" ,NULL ); -if (phy_mode) - interface =phy_get_interface_by_name (phy_mode); - -return interface; -} -static int eqos_remove_resources_tegra186 (struct udevice *dev) {struct eqos_priv *eqos =dev_get_priv (dev);
@@ -1985,7 +1957,7 @@ static const struct eqos_config __maybe_unused eqos_stm32_config = { .config_mac = EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_AV, .config_mac_mdio = EQOS_MAC_MDIO_ADDRESS_CR_250_300, .axi_bus_width = EQOS_AXI_WIDTH_64, - .interface = eqos_get_interface_stm32, + .interface = dev_read_phy_mode, .ops = &eqos_stm32_ops };
@@ -2013,7 +1985,7 @@ struct eqos_config __maybe_unused eqos_imx_config = { .config_mac = EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_DCB, .config_mac_mdio = EQOS_MAC_MDIO_ADDRESS_CR_250_300, .axi_bus_width = EQOS_AXI_WIDTH_64, - .interface = eqos_get_interface_imx, + .interface = dev_read_phy_mode, .ops = &eqos_imx_ops };
drivers/net/fec_mxc.c +2 -9
@@ -1558,20 +1558,13 @@ static int fecmxc_of_to_plat(struct udevice *dev)int ret =0 ;struct eth_pdata *pdata =dev_get_plat (dev);struct fec_priv *priv =dev_get_priv (dev); -const char *phy_mode; pdata->iobase =dev_read_addr (dev); priv->eth = (struct ethernet_regs *)pdata->iobase; - pdata->phy_interface =-1 ; - phy_mode =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"phy-mode" , -NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }#ifdef CONFIG_DM_REGULATOR device_get_supply_regulator (dev,"phy-supply" , &priv->phy_supply);
drivers/net/fm/eth.c +1 -12
@@ -954,17 +954,6 @@ int fm_eth_initialize(struct ccsr_fman *reg, struct fm_eth_info *info) return 0; }#else /* CONFIG_DM_ETH */ -#ifdef CONFIG_PHYLIB -phy_interface_t fman_read_sys_if (struct udevice *dev) -{ -const char *if_str; - - if_str =ofnode_read_string (dev_ofnode (dev),"phy-connection-type" ); -debug ("MAC system interface mode %s\n" , if_str); - -return phy_get_interface_by_name (if_str); -} -#endif static int fm_eth_bind (struct udevice *dev) {
@@ -1038,7 +1027,7 @@ static int fm_eth_probe(struct udevice *dev) reg = (void *)(uintptr_t )dev_read_addr (dev); fm_eth->mac_type =dev_get_driver_data (dev);#ifdef CONFIG_PHYLIB - fm_eth->enet_if =fman_read_sys_if (dev); + fm_eth->enet_if =dev_read_phy_mode (dev);#else fm_eth->enet_if =PHY_INTERFACE_MODE_SGMII ;printf ("%s: warning - unable to determine interface type\n" , __func__);
drivers/net/fsl_enetc.c +4 -9
@@ -260,9 +260,6 @@ static int enetc_init_sxgmii(struct udevice *dev)static void enetc_start_pcs (struct udevice *dev) {struct enetc_priv *priv =dev_get_priv (dev); -const char *if_str; - - priv->if_type =PHY_INTERFACE_MODE_NONE ;/* register internal MDIO for debug purposes */ if (enetc_read_port (priv,ENETC_PCAPR0 ) &ENETC_PCAPRO_MDIO ) {
@@ -279,14 +276,12 @@ static void enetc_start_pcs(struct udevice *dev)return ; } - if_str =ofnode_read_string (dev_ofnode (dev),"phy-mode" ); -if (if_str) - priv->if_type =phy_get_interface_by_name (if_str); -else + priv->if_type =dev_read_phy_mode (dev); +if (priv->if_type ==PHY_INTERFACE_MODE_NONE ) {enetc_dbg (dev,"phy-mode property not found, defaulting to SGMII\n" ); -if (priv->if_type <0 ) - priv->if_type =PHY_INTERFACE_MODE_NONE ; + priv->if_type =PHY_INTERFACE_MODE_SGMII ; + }switch (priv->if_type) {case PHY_INTERFACE_MODE_SGMII :
drivers/net/ftgmac100.c +3 -8
@@ -549,17 +549,12 @@ static int ftgmac100_of_to_plat(struct udevice *dev) {struct eth_pdata *pdata =dev_get_plat (dev);struct ftgmac100_data *priv =dev_get_priv (dev); -const char *phy_mode; pdata->iobase =dev_read_addr (dev); - pdata->phy_interface =-1 ; - phy_mode =dev_read_string (dev,"phy-mode" ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -dev_err (dev,"Invalid PHY interface '%s'\n" , phy_mode); + + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - } pdata->max_speed =dev_read_u32_default (dev,"max-speed" ,0 );
drivers/net/higmacv300.c +2 -7
@@ -561,19 +561,14 @@ static int higmac_remove(struct udevice *dev)static int higmac_of_to_plat (struct udevice *dev) {struct higmac_priv *priv =dev_get_priv (dev); -int phyintf =PHY_INTERFACE_MODE_NONE ; -const char *phy_mode;ofnode phy_node; priv->base =dev_remap_addr_index (dev,0 ); priv->macif_ctrl =dev_remap_addr_index (dev,1 ); - phy_mode =dev_read_string (dev,"phy-mode" ); -if (phy_mode) - phyintf =phy_get_interface_by_name (phy_mode); -if (phyintf ==PHY_INTERFACE_MODE_NONE ) + priv->phyintf =dev_read_phy_mode (dev); +if (priv->phyintf ==PHY_INTERFACE_MODE_NONE )return -ENODEV ; - priv->phyintf = phyintf; phy_node =dev_read_subnode (dev,"phy" );if (!ofnode_valid (phy_node)) {
drivers/net/ldpaa_eth/ldpaa_eth.c +5 -23
@@ -1120,31 +1120,14 @@ static uint32_t ldpaa_eth_get_dpmac_id(struct udevice *dev)return fdtdec_get_uint (gd->fdt_blob, port_node,"reg" ,-1 ); } -static const char *ldpaa_eth_get_phy_mode_str (struct udevice *dev) -{ -int port_node =dev_of_offset (dev); -const char *phy_mode_str; - - phy_mode_str =fdt_getprop (gd->fdt_blob, port_node, -"phy-connection-type" ,NULL ); -if (phy_mode_str) -return phy_mode_str; - - phy_mode_str =fdt_getprop (gd->fdt_blob, port_node,"phy-mode" ,NULL ); -return phy_mode_str; -} -static int ldpaa_eth_bind (struct udevice *dev) { -const char *phy_mode_str =NULL ;uint32_t dpmac_id;char eth_name[16 ];int phy_mode =-1 ; - phy_mode_str =ldpaa_eth_get_phy_mode_str (dev); -if (phy_mode_str) - phy_mode =phy_get_interface_by_name (phy_mode_str); -if (phy_mode ==-1 ) { + phy_mode =dev_read_phy_mode (dev); +if (phy_mode ==PHY_INTERFACE_MODE_NONE ) {dev_err (dev,"incorrect phy mode\n" );return -EINVAL ; }
@@ -1155,7 +1138,8 @@ static int ldpaa_eth_bind(struct udevice *dev)return -EINVAL ; } -sprintf (eth_name,"DPMAC%d@%s" , dpmac_id, phy_mode_str); +sprintf (eth_name,"DPMAC%d@%s" , dpmac_id, +phy_string_for_interface (phy_mode));device_set_name (dev, eth_name);return 0 ;
@@ -1164,11 +1148,9 @@ static int ldpaa_eth_bind(struct udevice *dev)static int ldpaa_eth_of_to_plat (struct udevice *dev) {struct ldpaa_eth_priv *priv =dev_get_priv (dev); -const char *phy_mode_str; priv->dpmac_id =ldpaa_eth_get_dpmac_id (dev); - phy_mode_str =ldpaa_eth_get_phy_mode_str (dev); - priv->phy_mode =phy_get_interface_by_name (phy_mode_str); + priv->phy_mode =dev_read_phy_mode (dev);return 0 ; }
drivers/net/macb.c +2 -8
@@ -1360,17 +1360,11 @@ static int macb_eth_probe(struct udevice *dev)struct eth_pdata *pdata =dev_get_plat (dev);struct macb_device *macb =dev_get_priv (dev);struct ofnode_phandle_args phandle_args; -const char *phy_mode;int ret; - phy_mode =dev_read_prop (dev,"phy-mode" ,NULL ); - -if (phy_mode) - macb->phy_interface =phy_get_interface_by_name (phy_mode); -if (macb->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + macb->phy_interface =dev_read_phy_mode (dev); +if (macb->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }/* Read phyaddr from DT */ if (!dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
drivers/net/mt7620-eth.c +11 -24
@@ -1048,33 +1048,20 @@ static int mt7620_eth_parse_gsw_port(struct mt7620_eth_priv *priv, u32 idx, ofnode node) {ofnode subnode; -const char *str; -int mode, speed, ret; +int speed, ret;u32 phy_addr; - str =ofnode_read_string (node,"phy-mode" ); -if (str) { - mode =phy_get_interface_by_name (str); -if (mode <0 ) { -dev_err (priv->dev,"mt7620_eth: invalid phy-mode\n" ); -return -EINVAL ; - } - -switch (mode) { -case PHY_INTERFACE_MODE_MII : -case PHY_INTERFACE_MODE_RMII : -case PHY_INTERFACE_MODE_RGMII : -case PHY_INTERFACE_MODE_NONE : -break ; -default : -dev_err (priv->dev, -"mt7620_eth: unsupported phy-mode\n" ); -return -ENOTSUPP ; - } + priv->port_cfg[idx].mode =ofnode_read_phy_mode (node); - priv->port_cfg[idx].mode = mode; - }else { - priv->port_cfg[idx].mode =PHY_INTERFACE_MODE_NONE ; +switch (priv->port_cfg[idx].mode) { +case PHY_INTERFACE_MODE_MII : +case PHY_INTERFACE_MODE_RMII : +case PHY_INTERFACE_MODE_RGMII : +case PHY_INTERFACE_MODE_NONE : +break ; +default : +dev_err (priv->dev,"mt7620_eth: unsupported phy-mode\n" ); +return -ENOTSUPP ; } subnode =ofnode_find_subnode (node,"fixed-link" );
drivers/net/mtk_eth.c +3 -5
@@ -1447,11 +1447,9 @@ static int mtk_eth_of_to_plat(struct udevice *dev) priv->gmac_id =dev_read_u32_default (dev,"mediatek,gmac-id" ,0 );/* Interface mode is required */ - str =dev_read_string (dev,"phy-mode" ); -if (str) { - pdata->phy_interface =phy_get_interface_by_name (str); - priv->phy_interface = pdata->phy_interface; - }else { + pdata->phy_interface =dev_read_phy_mode (dev); + priv->phy_interface = pdata->phy_interface; +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) {printf ("error: phy-mode is not set\n" );return -EINVAL ; }
drivers/net/mvgbe.c +2 -5
@@ -993,7 +993,6 @@ static int mvgbe_of_to_plat(struct udevice *dev)struct mvgbe_device *dmvgbe =dev_get_priv (dev);void *blob = (void *)gd->fdt_blob;int node =dev_of_offset (dev); -const char *phy_mode;int fl_node;int pnode;unsigned long addr;
@@ -1005,10 +1004,8 @@ static int mvgbe_of_to_plat(struct udevice *dev) "marvell,kirkwood-eth-port");/* Get phy-mode / phy_interface from DT */ - phy_mode =fdt_getprop (gd->fdt_blob, pnode,"phy-mode" ,NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -else + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) pdata->phy_interface =PHY_INTERFACE_MODE_GMII ; dmvgbe->phy_interface = pdata->phy_interface;
drivers/net/mvneta.c +2 -9
@@ -1799,20 +1799,13 @@ static const struct eth_ops mvneta_ops = {static int mvneta_of_to_plat (struct udevice *dev) {struct eth_pdata *pdata =dev_get_plat (dev); -const char *phy_mode; pdata->iobase =dev_read_addr (dev);/* Get phy-mode / phy_interface from DT */ - pdata->phy_interface =-1 ; - phy_mode =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"phy-mode" , -NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }return 0 ; }
drivers/net/mvpp2.c +2 -7
@@ -4786,11 +4786,9 @@ static int mvpp2_port_init(struct udevice *dev, struct mvpp2_port *port)static int phy_info_parse (struct udevice *dev,struct mvpp2_port *port) {int port_node =dev_of_offset (dev); -const char *phy_mode_str;int phy_node;u32 id;u32 phyaddr =0 ; -int phy_mode =-1 ;int fixed_link =0 ;int ret;
@@ -4821,10 +4819,8 @@ static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port) phyaddr =PHY_MAX_ADDR ; } - phy_mode_str =fdt_getprop (gd->fdt_blob, port_node,"phy-mode" ,NULL ); -if (phy_mode_str) - phy_mode =phy_get_interface_by_name (phy_mode_str); -if (phy_mode ==-1 ) { + port->phy_interface =dev_read_phy_mode (dev); +if (port->phy_interface ==PHY_INTERFACE_MODE_NONE ) {dev_err (dev,"incorrect phy mode\n" );return -EINVAL ; }
@@ -4847,7 +4843,6 @@ static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port) port->first_rxq = port->id * rxq_number; else port->first_rxq = port->id * port->priv->max_port_rxqs; - port->phy_interface = phy_mode; port->phyaddr = phyaddr;return 0 ;
drivers/net/phy/phy.c +2 -23
@@ -982,25 +982,16 @@ static struct phy_device *phy_connect_gmii2rgmii(struct mii_dev *bus,*/ struct phy_device *fixed_phy_create (ofnode node) { -phy_interface_t interface =PHY_INTERFACE_MODE_NONE ;struct phy_device *phydev; -const char *if_str;ofnode subnode; - if_str =ofnode_read_string (node,"phy-mode" ); -if (!if_str) { - if_str =ofnode_read_string (node,"phy-connection-type" ); - } -if (if_str) { - interface =phy_get_interface_by_name (if_str); - } - subnode =ofnode_find_subnode (node,"fixed-link" );if (!ofnode_valid (subnode)) {return NULL ; } - phydev =phy_device_create (NULL ,0 ,PHY_FIXED_ID , false, interface); + phydev =phy_device_create (NULL ,0 ,PHY_FIXED_ID , false, +ofnode_read_phy_mode (node));if (phydev) phydev->node = subnode;
@@ -1093,15 +1084,3 @@ int phy_shutdown(struct phy_device *phydev)return 0 ; } - -int phy_get_interface_by_name (const char *str) -{ -int i; - -for (i =0 ; i <PHY_INTERFACE_MODE_COUNT ; i++) { -if (!strcmp (str, phy_interface_strings[i])) -return i; - } - -return -1 ; -}
drivers/net/pic32_eth.c +2 -9
@@ -534,7 +534,6 @@ static int pic32_eth_probe(struct udevice *dev) {struct eth_pdata *pdata =dev_get_plat (dev);struct pic32eth_dev *priv =dev_get_priv (dev); -const char *phy_mode;void __iomem *iobase;fdt_addr_t addr;fdt_size_t size;
@@ -550,15 +549,9 @@ static int pic32_eth_probe(struct udevice *dev) pdata->iobase = (phys_addr_t )addr;/* get phy mode */ - pdata->phy_interface =-1 ; - phy_mode =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"phy-mode" , -NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }/* get phy addr */ offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev),
drivers/net/qe/dm_qe_uec.c +2 -9
@@ -1133,19 +1133,12 @@ static int qe_uec_remove(struct udevice *dev)static int qe_uec_of_to_plat (struct udevice *dev) {struct eth_pdata *pdata =dev_get_plat (dev); -const char *phy_mode; pdata->iobase = (phys_addr_t )devfdt_get_addr (dev); - pdata->phy_interface =-1 ; - phy_mode =fdt_getprop (gd->fdt_blob,dev_of_offset (dev), -"phy-connection-type" ,NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }return 0 ; }
drivers/net/ravb.c +4 -11
@@ -674,20 +674,13 @@ static const struct eth_ops ravb_ops = {int ravb_of_to_plat (struct udevice *dev) {struct eth_pdata *pdata =dev_get_plat (dev); -const char *phy_mode;const fdt32_t *cell; -int ret =0 ; pdata->iobase =dev_read_addr (dev); - pdata->phy_interface =-1 ; - phy_mode =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"phy-mode" , -NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - } pdata->max_speed =1000 ; cell =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"max-speed" ,NULL );
@@ -696,7 +689,7 @@ int ravb_of_to_plat(struct udevice *dev)sprintf (bb_miiphy_buses[0 ].name, dev->name); -return ret; +return 0 ; }static const struct udevice_id ravb_ids[] = {
drivers/net/sh_eth.c +4 -11
@@ -915,20 +915,13 @@ static const struct eth_ops sh_ether_ops = {int sh_ether_of_to_plat (struct udevice *dev) {struct eth_pdata *pdata =dev_get_plat (dev); -const char *phy_mode;const fdt32_t *cell; -int ret =0 ; pdata->iobase =dev_read_addr (dev); - pdata->phy_interface =-1 ; - phy_mode =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"phy-mode" , -NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - } pdata->max_speed =1000 ; cell =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"max-speed" ,NULL );
@@ -937,7 +930,7 @@ int sh_ether_of_to_plat(struct udevice *dev)sprintf (bb_miiphy_buses[0 ].name, dev->name); -return ret; +return 0 ; }static const struct udevice_id sh_ether_ids[] = {
drivers/net/sni_ave.c +3 -9
@@ -738,7 +738,6 @@ static int ave_of_to_plat(struct udevice *dev)struct eth_pdata *pdata =dev_get_plat (dev);struct ave_private *priv =dev_get_priv (dev);struct ofnode_phandle_args args; -const char *phy_mode;const u32 *valp;int ret, nc, nr;const char *name;
@@ -748,15 +747,10 @@ static int ave_of_to_plat(struct udevice *dev)return -EINVAL ; pdata->iobase =dev_read_addr (dev); - pdata->phy_interface =-1 ; - phy_mode =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"phy-mode" , -NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -dev_err (dev,"Invalid PHY interface '%s'\n" , phy_mode); + + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - } pdata->max_speed =0 ; valp = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "max-speed",
drivers/net/sni_netsec.c +2 -8
@@ -1029,19 +1029,13 @@ static int netsec_of_to_plat(struct udevice *dev)struct eth_pdata *pdata =dev_get_plat (dev);struct netsec_priv *priv =dev_get_priv (dev);struct ofnode_phandle_args phandle_args; -const char *phy_mode; pdata->iobase =dev_read_addr_index (dev,0 ); priv->eeprom_base =dev_read_addr_index (dev,1 ) -EERPROM_MAP_OFFSET ; - pdata->phy_interface =-1 ; - phy_mode =dev_read_prop (dev,"phy-mode" ,NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -pr_err ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }if (!dev_read_phandle_with_args (dev,"phy-handle" ,NULL ,0 ,0 , &phandle_args))
drivers/net/sun8i_emac.c +2 -9
@@ -882,7 +882,6 @@ static int sun8i_emac_eth_of_to_plat(struct udevice *dev)struct sun8i_eth_pdata *sun8i_pdata =dev_get_plat (dev);struct eth_pdata *pdata = &sun8i_pdata->eth_pdata;struct emac_eth_dev *priv =dev_get_priv (dev); -const char *phy_mode;const fdt32_t *reg;int node =dev_of_offset (dev);int offset =0 ;
@@ -946,16 +945,10 @@ static int sun8i_emac_eth_of_to_plat(struct udevice *dev) } priv->phyaddr =fdtdec_get_int (gd->fdt_blob, offset,"reg" ,-1 ); - phy_mode =fdt_getprop (gd->fdt_blob, node,"phy-mode" ,NULL ); - -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev);printf ("phy interface%d\n" , pdata->phy_interface); - -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }if (priv->variant ==H3_EMAC ) { ret =sun8i_handle_internal_phy (dev, priv);
drivers/net/ti/am65-cpsw-nuss.c +4 -11
@@ -602,21 +602,14 @@ static int am65_cpsw_ofdata_parse_phy(struct udevice *dev)struct eth_pdata *pdata =dev_get_plat (dev);struct am65_cpsw_priv *priv =dev_get_priv (dev);struct ofnode_phandle_args out_args; -const char *phy_mode;int ret =0 ;dev_read_u32 (dev,"reg" , &priv->port_id); - phy_mode =dev_read_string (dev,"phy-mode" ); -if (phy_mode) { - pdata->phy_interface = -phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -dev_err (dev,"Invalid PHY mode '%s', port %u\n" , - phy_mode, priv->port_id); - ret = -EINVAL ; - goto out; - } + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) { +dev_err (dev,"Invalid PHY mode, port %u\n" , priv->port_id); +return -EINVAL ; }dev_read_u32 (dev,"max-speed" , (u32 *)&pdata->max_speed);
drivers/net/ti/cpsw.c +2 -8
@@ -1194,15 +1194,12 @@ static void cpsw_eth_of_parse_slave(struct cpsw_platform_data *data, {struct ofnode_phandle_args out_args;struct cpsw_slave_data *slave_data; -const char *phy_mode;u32 phy_id[2 ];int ret; slave_data = &data->slave_data[slave_index]; - phy_mode =ofnode_read_string (subnode,"phy-mode" ); -if (phy_mode) - slave_data->phy_if =phy_get_interface_by_name (phy_mode); + slave_data->phy_if =ofnode_read_phy_mode (subnode); ret =ofnode_parse_phandle_with_args (subnode,"phy-handle" ,NULL ,0 ,0 , &out_args);
@@ -1348,11 +1345,8 @@ static int cpsw_eth_of_to_plat(struct udevice *dev) } pdata->phy_interface = data->slave_data[data->active_slave].phy_if; -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, -phy_string_for_interface (pdata->phy_interface)); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }return 0 ; }
drivers/net/ti/keystone_net.c +11 -13
@@ -687,7 +687,6 @@ static int ks2_eth_parse_slave_interface(int netcp, int slave,int phy;int dma_count;u32 dma_channel[8 ]; -const char *phy_mode; priv->slave_port =fdtdec_get_int (fdt, slave,"slave-port" ,-1 ); priv->net_rx_buffs.rx_flow = priv->slave_port *8 ;
@@ -728,20 +727,19 @@ static int ks2_eth_parse_slave_interface(int netcp, int slave, priv->sgmii_link_type =SGMII_LINK_MAC_PHY ; priv->has_mdio = true; }else if (priv->link_type ==LINK_TYPE_RGMII_LINK_MAC_PHY ) { - phy_mode =fdt_getprop (fdt, slave,"phy-mode" ,NULL ); -if (phy_mode) { - priv->phy_if =phy_get_interface_by_name (phy_mode); -if (priv->phy_if !=PHY_INTERFACE_MODE_RGMII && - priv->phy_if !=PHY_INTERFACE_MODE_RGMII_ID && - priv->phy_if !=PHY_INTERFACE_MODE_RGMII_RXID && - priv->phy_if !=PHY_INTERFACE_MODE_RGMII_TXID ) { -pr_err ("invalid phy-mode\n" ); -return -EINVAL ; - } - }else { + priv->phy_if =ofnode_read_phy_mode (offset_to_ofnode (slave)); +if (priv->phy_if ==PHY_INTERFACE_MODE_NONE ) priv->phy_if =PHY_INTERFACE_MODE_RGMII ; - } pdata->phy_interface = priv->phy_if; + +if (priv->phy_if !=PHY_INTERFACE_MODE_RGMII && + priv->phy_if !=PHY_INTERFACE_MODE_RGMII_ID && + priv->phy_if !=PHY_INTERFACE_MODE_RGMII_RXID && + priv->phy_if !=PHY_INTERFACE_MODE_RGMII_TXID ) { +pr_err ("invalid phy-mode\n" ); +return -EINVAL ; + } + priv->has_mdio = true; }
drivers/net/tsec.c +2 -7
@@ -834,7 +834,6 @@ int tsec_probe(struct udevice *dev)struct ofnode_phandle_args phandle_args;u32 tbiaddr =CONFIG_SYS_TBIPA_VALUE ;struct tsec_data *data; -const char *phy_mode;ofnode parent, child;fdt_addr_t reg;u32 max_speed;
@@ -894,12 +893,8 @@ int tsec_probe(struct udevice *dev) priv->tbiaddr = tbiaddr; - phy_mode =dev_read_prop (dev,"phy-connection-type" ,NULL ); -if (!phy_mode) - phy_mode =dev_read_prop (dev,"phy-mode" ,NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) pdata->phy_interface =tsec_get_interface (priv); priv->interface = pdata->phy_interface;
drivers/net/xilinx_axi_emac.c +2 -8
@@ -821,7 +821,6 @@ static int axi_emac_of_to_plat(struct udevice *dev)struct eth_pdata *pdata = &plat->eth_pdata;int node =dev_of_offset (dev);int offset =0 ; -const char *phy_mode; pdata->iobase =dev_read_addr (dev); plat->mactype =dev_get_driver_data (dev);
@@ -850,14 +849,9 @@ static int axi_emac_of_to_plat(struct udevice *dev) plat->phy_of_handle = offset; } - phy_mode =fdt_getprop (gd->fdt_blob, node,"phy-mode" ,NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -printf ("%s: Invalid PHY interface '%s'\n" , __func__, - phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - } plat->eth_hasnobuf =fdtdec_get_bool (gd->fdt_blob, node,"xlnx,eth-hasnobuf" );
drivers/net/zynq_gem.c +2 -7
@@ -827,7 +827,6 @@ static int zynq_gem_of_to_plat(struct udevice *dev)struct eth_pdata *pdata =dev_get_plat (dev);struct zynq_gem_priv *priv =dev_get_priv (dev);struct ofnode_phandle_args phandle_args; -const char *phy_mode; pdata->iobase = (phys_addr_t )dev_read_addr (dev); priv->iobase = (struct zynq_gem_regs *)pdata->iobase;
@@ -859,13 +858,9 @@ static int zynq_gem_of_to_plat(struct udevice *dev) } } - phy_mode =dev_read_prop (dev,"phy-mode" ,NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - } priv->interface = pdata->phy_interface; priv->int_pcs =dev_read_bool (dev,"is-internal-pcspma" );
include/dm/ofnode.h +13 -0
@@ -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
@@ -1218,4 +1219,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
include/dm/read.h +17 -0
@@ -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 <asm/global_data.h>
@@ -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 */ /**
include/phy.h +0 -8
@@ -542,14 +542,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)
net/mdio-uclass.c +1 -17
@@ -15,11 +15,6 @@#include <dm/uclass-internal.h> #include <linux/compat.h> -/* DT node properties for MAC-PHY interface */ -static const char *const phy_mode_str[] = { -"phy-mode" ,"phy-connection-type" -}; -void dm_mdio_probe_devices (void ) {struct udevice *it;
@@ -195,26 +190,15 @@ out:/* Connect to a PHY linked in eth DT node */ struct phy_device *dm_eth_phy_connect (struct udevice *ethdev) { -const char *if_str;phy_interface_t interface;struct phy_device *phy; -int i;if (!dev_has_ofnode (ethdev)) {debug ("%s: supplied eth dev has no DT node!\n" , ethdev->name);return NULL ; } - interface =PHY_INTERFACE_MODE_NONE ; -for (i =0 ; i <ARRAY_SIZE (phy_mode_str); i++) { - if_str =dev_read_string (ethdev, phy_mode_str[i]); -if (if_str) { - interface =phy_get_interface_by_name (if_str); -break ; - } - } -if (interface <0 ) - interface =PHY_INTERFACE_MODE_NONE ; + interface =dev_read_phy_mode (ethdev);if (interface ==PHY_INTERFACE_MODE_NONE )dev_dbg (ethdev,"can't find interface mode, default to NONE\n" );
Signature · 1 line
2.34.1
PATCH 10/14 phy: Move PHY_INTERFACE_MODE_NA to the beginning of the enum definition
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
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.
--- include/phy_interface.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
include/phy_interface.h +2 -3
@@ -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_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:
Signature · 1 line
2.34.1
PATCH 13/14 bcmgenet, sun8i_emac: Don't connect PHY two times
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
The bcmgenet and sun8i_emac drivers call phy_connect(), which finds / creates the PHY and also connects it to the eth device via phy_connect_dev(), then set some phydev members (bcmgenet only), and then call phy_connect_dev() explicitly again.
Drop the second phy_connect_dev(), since it is unnecesary.
--- drivers/net/bcmgenet.c | 2 -- drivers/net/sun8i_emac.c | 2 -- 2 files changed, 4 deletions(-)
drivers/net/bcmgenet.c +0 -2
@@ -526,8 +526,6 @@ static int bcmgenet_phy_init(struct bcmgenet_eth_priv *priv, void *dev) } phydev->advertising = phydev->supported; -phy_connect_dev (phydev, dev); - priv->phydev = phydev;phy_config (priv->phydev);
drivers/net/sun8i_emac.c +0 -2
@@ -391,8 +391,6 @@ static int sun8i_phy_init(struct emac_eth_dev *priv, void *dev)if (!phydev)return -ENODEV ; -phy_connect_dev (phydev, dev); - priv->phydev = phydev;phy_config (priv->phydev);
Signature · 1 line
2.34.1
PATCH 3/14 net: introduce helpers to get PHY ofnode from MAC
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
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().
This is useful because other part's of U-Boot may want to get PHY ofnode without connecting a PHY.
--- drivers/core/ofnode.c | 21 +++++++++++++++++++++ drivers/core/read.c | 5 +++++ include/dm/ofnode.h | 14 ++++++++++++++ include/dm/read.h | 19 +++++++++++++++++++ net/mdio-uclass.c | 24 ++++++------------------ 5 files changed, 65 insertions(+), 18 deletions(-)
drivers/core/ofnode.c +21 -0
@@ -1162,3 +1162,24 @@ const char *ofnode_conf_read_str(const char *prop_name)return ofnode_read_string (node, prop_name); } + +ofnode ofnode_get_phy_node (ofnode node) +{ +/* DT node properties that reference a PHY node */ +static const char *const phy_handle_str[] = { +"phy-handle" ,"phy" ,"phy-device" , + }; +struct ofnode_phandle_args args = { + .node =ofnode_null () + }; +int i; + +assert (ofnode_valid (node)); + +for (i =0 ; i <ARRAY_SIZE (phy_handle_str); i++) +if (!ofnode_parse_phandle_with_args (node, phy_handle_str[i], +NULL ,0 ,0 , &args)) +break ; + +return args.node; +}
drivers/core/read.c +5 -0
@@ -398,3 +398,8 @@ int dev_decode_display_timing(const struct udevice *dev, int index, {return ofnode_decode_display_timing (dev_ofnode (dev), index, config); } + +ofnode dev_get_phy_node (const struct udevice *dev) +{ +return ofnode_get_phy_node (dev_ofnode (dev)); +}
include/dm/ofnode.h +14 -0
@@ -1204,4 +1204,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
include/dm/read.h +19 -0
@@ -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 <asm/global_data.h>
@@ -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 */ /**
net/mdio-uclass.c +6 -18
@@ -20,11 +20,6 @@ static const char * const phy_mode_str[] = { "phy-mode", "phy-connection-type" }; -/* DT node properties that reference a PHY node */ -static const char *const phy_handle_str[] = { -"phy-handle" ,"phy" ,"phy-device" -}; -void dm_mdio_probe_devices (void ) {struct udevice *it;
@@ -137,23 +132,16 @@ static struct phy_device *dm_eth_connect_phy_handle(struct udevice *ethdev,u32 phy_addr;struct udevice *mdiodev;struct phy_device *phy; -struct ofnode_phandle_args phandle = {.node =ofnode_null ()};ofnode phynode; -int i;if (CONFIG_IS_ENABLED (PHY_FIXED ) &&ofnode_phy_is_fixed_link (dev_ofnode (ethdev), &phynode)) { phy =phy_connect (NULL ,0 , ethdev, interface); - phandle.node = phynode; goto out; } -for (i =0 ; i <ARRAY_SIZE (phy_handle_str); i++) -if (!dev_read_phandle_with_args (ethdev, phy_handle_str[i],NULL , -0 ,0 , &phandle)) -break ; - -if (!ofnode_valid (phandle.node)) { + phynode =dev_get_phy_node (ethdev); +if (!ofnode_valid (phynode)) {dev_dbg (ethdev,"can't find PHY node\n" );return NULL ; }
@@ -162,16 +150,16 @@ static struct phy_device *dm_eth_connect_phy_handle(struct udevice *ethdev,* reading 'reg' directly should be fine. This is a PHY node, the * address is always size 1 and requires no translation */ -if (ofnode_read_u32 (phandle.node,"reg" , &phy_addr)) { +if (ofnode_read_u32 (phynode,"reg" , &phy_addr)) {dev_dbg (ethdev,"missing reg property in phy node\n" );return NULL ; }if (uclass_get_device_by_ofnode (UCLASS_MDIO , -ofnode_get_parent (phandle.node), +ofnode_get_parent (phynode), &mdiodev)) {dev_dbg (ethdev,"can't find MDIO bus for node %s\n" , -ofnode_get_name (ofnode_get_parent (phandle.node))); +ofnode_get_name (ofnode_get_parent (phynode)));return NULL ; }
@@ -179,7 +167,7 @@ static struct phy_device *dm_eth_connect_phy_handle(struct udevice *ethdev, out:if (phy) - phy->node = phandle.node; + phy->node = phynode;return phy; }
Signature · 1 line
2.34.1
PATCH 11/14 net: phy: xilinx: Check interface type in ->config(), not ->probe()
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
We want to be able to have phydev->interface uninitialized during ->probe(). We should assume that phydev->interface is initialized only before ->config().
--- drivers/net/phy/xilinx_gmii2rgmii.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/phy/xilinx_gmii2rgmii.c +5 -5
@@ -26,6 +26,11 @@ static int xilinxgmiitorgmii_config(struct phy_device *phydev)debug ("%s\n" , __func__); +if (phydev->interface !=PHY_INTERFACE_MODE_GMII ) { +printf ("Incorrect interface type\n" ); +return -EINVAL ; + } +if (!ofnode_valid (node))return -EINVAL ;
@@ -114,11 +119,6 @@ static int xilinxgmiitorgmii_probe(struct phy_device *phydev) {debug ("%s\n" , __func__); -if (phydev->interface !=PHY_INTERFACE_MODE_GMII ) { -printf ("Incorrect interface type\n" ); -return -EINVAL ; - } - phydev->flags |=PHY_FLAG_BROKEN_RESET ;return 0 ;
Signature · 1 line
2.34.1
PATCH 9/14 treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
Rename constant PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA to make it compatible with Linux' naming.
--- board/freescale/corenet_ds/eth_hydra.c | 2 +- board/freescale/corenet_ds/eth_superhydra.c | 4 ++-- board/freescale/t104xrdb/eth.c | 4 ++-- drivers/core/ofnode.c | 4 ++-- drivers/net/ag7xxx.c | 2 +- drivers/net/altera_tse.c | 2 +- drivers/net/bcm6348-eth.c | 2 +- drivers/net/bcmgenet.c | 2 +- drivers/net/designware.c | 2 +- drivers/net/dwc_eth_qos.c | 4 ++-- drivers/net/fec_mxc.c | 2 +- drivers/net/fm/b4860.c | 8 ++++---- drivers/net/fm/init.c | 8 ++++---- drivers/net/fm/ls1043.c | 6 +++--- drivers/net/fm/ls1046.c | 8 ++++---- drivers/net/fm/p1023.c | 4 ++-- drivers/net/fm/p4080.c | 6 +++--- drivers/net/fm/p5020.c | 6 +++--- drivers/net/fm/p5040.c | 6 +++--- drivers/net/fm/t1024.c | 4 ++-- drivers/net/fm/t1040.c | 4 ++-- drivers/net/fm/t2080.c | 6 +++--- drivers/net/fm/t4240.c | 6 +++--- drivers/net/fsl_enetc.c | 2 +- drivers/net/ftgmac100.c | 2 +- drivers/net/higmacv300.c | 2 +- drivers/net/ldpaa_eth/ldpaa_eth.c | 2 +- drivers/net/ldpaa_eth/ldpaa_wriop.c | 10 +++++----- drivers/net/ldpaa_eth/ls1088a.c | 4 ++-- drivers/net/ldpaa_eth/ls2080a.c | 4 ++-- drivers/net/ldpaa_eth/lx2160a.c | 4 ++-- drivers/net/macb.c | 2 +- drivers/net/mscc_eswitch/jr2_switch.c | 2 +- drivers/net/mscc_eswitch/luton_switch.c | 2 +- drivers/net/mscc_eswitch/ocelot_switch.c | 2 +- drivers/net/mscc_eswitch/serval_switch.c | 2 +- drivers/net/mscc_eswitch/servalt_switch.c | 2 +- drivers/net/mt7620-eth.c | 12 ++++++------ drivers/net/mtk_eth.c | 2 +- drivers/net/mvgbe.c | 2 +- drivers/net/mvneta.c | 2 +- drivers/net/mvpp2.c | 2 +- drivers/net/pic32_eth.c | 2 +- drivers/net/qe/dm_qe_uec.c | 2 +- drivers/net/ravb.c | 2 +- drivers/net/sh_eth.c | 2 +- drivers/net/sni_ave.c | 2 +- drivers/net/sni_netsec.c | 2 +- drivers/net/sun8i_emac.c | 2 +- drivers/net/ti/am65-cpsw-nuss.c | 2 +- drivers/net/ti/cpsw.c | 2 +- drivers/net/ti/keystone_net.c | 2 +- drivers/net/tsec.c | 2 +- drivers/net/xilinx_axi_emac.c | 2 +- drivers/net/zynq_gem.c | 2 +- include/dm/ofnode.h | 2 +- include/dm/read.h | 2 +- include/fm_eth.h | 2 +- include/phy_interface.h | 8 ++++---- include/vsc9953.h | 2 +- net/mdio-uclass.c | 4 ++-- 61 files changed, 105 insertions(+), 105 deletions(-)
board/freescale/corenet_ds/eth_hydra.c +1 -1
@@ -471,7 +471,7 @@ int board_eth_init(struct bd_info *bis)fm_info_set_mdio (i,miiphy_get_dev_by_name ("HYDRA_RGMII_MDIO" ));break ; -case PHY_INTERFACE_MODE_NONE : +case PHY_INTERFACE_MODE_NA :fm_info_set_phy_address (i,0 );break ;default :
board/freescale/corenet_ds/eth_superhydra.c +2 -2
@@ -583,7 +583,7 @@ int board_eth_init(struct bd_info *bis)fm_info_set_mdio (i,miiphy_get_dev_by_name ("SUPER_HYDRA_RGMII_MDIO" ));break ; -case PHY_INTERFACE_MODE_NONE : +case PHY_INTERFACE_MODE_NA :fm_info_set_phy_address (i,0 );break ;default :
@@ -733,7 +733,7 @@ int board_eth_init(struct bd_info *bis)fm_info_set_mdio (i,miiphy_get_dev_by_name ("SUPER_HYDRA_RGMII_MDIO" ));break ; -case PHY_INTERFACE_MODE_NONE : +case PHY_INTERFACE_MODE_NA :fm_info_set_phy_address (i,0 );break ;default :
board/freescale/t104xrdb/eth.c +2 -2
@@ -89,7 +89,7 @@ int board_eth_init(struct bd_info *bis)case PHY_INTERFACE_MODE_QSGMII :fm_info_set_phy_address (i,0 );break ; -case PHY_INTERFACE_MODE_NONE : +case PHY_INTERFACE_MODE_NA :fm_info_set_phy_address (i,0 );break ;default :
@@ -99,7 +99,7 @@ int board_eth_init(struct bd_info *bis)break ; }if (fm_info_get_enet_if (i) ==PHY_INTERFACE_MODE_QSGMII || -fm_info_get_enet_if (i) ==PHY_INTERFACE_MODE_NONE ) +fm_info_get_enet_if (i) ==PHY_INTERFACE_MODE_NA )fm_info_set_mdio (i,NULL );else fm_info_set_mdio(i,
drivers/core/ofnode.c +2 -2
@@ -1196,7 +1196,7 @@ phy_interface_t ofnode_read_phy_mode(ofnode node) mode =ofnode_read_string (node,"phy-connection-type" );if (!mode) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;for (i =0 ; i <PHY_INTERFACE_MODE_MAX ; i++)if (!strcmp (mode, phy_interface_strings[i]))
@@ -1204,5 +1204,5 @@ phy_interface_t ofnode_read_phy_mode(ofnode node)debug ("%s: Invalid PHY interface '%s'\n" , __func__, mode); -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }
drivers/net/ag7xxx.c +1 -1
@@ -1265,7 +1265,7 @@ static int ag7xxx_eth_of_to_plat(struct udevice *dev)return ret; pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;return 0 ;
drivers/net/altera_tse.c +1 -1
@@ -678,7 +678,7 @@ static int altera_tse_of_to_plat(struct udevice *dev)struct eth_pdata *pdata =dev_get_plat (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;return 0 ;
drivers/net/bcm6348-eth.c +1 -1
@@ -425,7 +425,7 @@ static int bcm6348_eth_probe(struct udevice *dev)/* get phy mode */ pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -ENODEV ;/* get phy */
drivers/net/bcmgenet.c +1 -1
@@ -696,7 +696,7 @@ static int bcmgenet_eth_of_to_plat(struct udevice *dev)/* Get phy mode from DT */ pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; ret = dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
drivers/net/designware.c +1 -1
@@ -921,7 +921,7 @@ int designware_eth_of_to_plat(struct udevice *dev) pdata->iobase =dev_read_addr (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; pdata->max_speed =dev_read_u32_default (dev,"max-speed" ,0 );
drivers/net/dwc_eth_qos.c +2 -2
@@ -1682,7 +1682,7 @@ static int eqos_probe_resources_stm32(struct udevice *dev) interface = eqos->config->interface (dev); -if (interface ==PHY_INTERFACE_MODE_NONE ) { +if (interface ==PHY_INTERFACE_MODE_NA ) {pr_err ("Invalid PHY interface\n" );return -EINVAL ; }
@@ -1743,7 +1743,7 @@ static int eqos_probe_resources_imx(struct udevice *dev) interface = eqos->config->interface (dev); -if (interface ==PHY_INTERFACE_MODE_NONE ) { +if (interface ==PHY_INTERFACE_MODE_NA ) {pr_err ("Invalid PHY interface\n" );return -EINVAL ; }
drivers/net/fec_mxc.c +1 -1
@@ -1563,7 +1563,7 @@ static int fecmxc_of_to_plat(struct udevice *dev) priv->eth = (struct ethernet_regs *)pdata->iobase; pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;#ifdef CONFIG_DM_REGULATOR
drivers/net/fm/b4860.c +4 -4
@@ -55,7 +55,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)#endif if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;/*B4860 has two 10Gig Mac*/ if ((port == FM1_10GEC1 || port == FM1_10GEC2) &&
@@ -112,7 +112,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port) (port == FM1_DTSEC2) || (port == FM1_DTSEC3) || (port == FM1_DTSEC4)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } } }
@@ -131,8 +131,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_SGMII ;break ;default : -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }
drivers/net/fm/init.c +4 -4
@@ -130,7 +130,7 @@ static int fm_port_to_index(enum fm_port port)/* * Determine if an interface is actually active based on HW config -* we expect fman_port_enet_if() to report PHY_INTERFACE_MODE_NONE if +* we expect fman_port_enet_if() to report PHY_INTERFACE_MODE_NA if * the interface is not active based on HW cfg of the SoC */ void fman_enet_init (void )
@@ -141,7 +141,7 @@ void fman_enet_init(void)phy_interface_t enet_if; enet_if =fman_port_enet_if (fm_info[i].port); -if (enet_if !=PHY_INTERFACE_MODE_NONE ) { +if (enet_if !=PHY_INTERFACE_MODE_NA ) { fm_info[i].enabled =1 ; fm_info[i].enet_if = enet_if; }else {
@@ -221,12 +221,12 @@ phy_interface_t fm_info_get_enet_if(enum fm_port port)int i =fm_port_to_index (port);if (i ==-1 ) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if (fm_info[i].enabled)return fm_info[i].enet_if; -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } static void
drivers/net/fm/ls1043.c +3 -3
@@ -54,13 +54,13 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr13 =in_be32 (&gur->rcwsr[13 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC1 ) && (is_serdes_configured (XFI_FM1_MAC9 )))return PHY_INTERFACE_MODE_XGMII ;if ((port ==FM1_DTSEC9 ) && (is_serdes_configured (XFI_FM1_MAC9 ))) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if (port ==FM1_DTSEC3 ) if ((rcwsr13 & FSL_CHASSIS2_RCWSR13_EC1) ==
@@ -107,5 +107,5 @@ phy_interface_t fman_port_enet_if(enum fm_port port)break ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }
drivers/net/fm/ls1046.c +4 -4
@@ -54,19 +54,19 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr13 =in_be32 (&gur->rcwsr[13 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC1 ) && (is_serdes_configured (XFI_FM1_MAC9 )))return PHY_INTERFACE_MODE_XGMII ;if ((port ==FM1_DTSEC9 ) && (is_serdes_configured (XFI_FM1_MAC9 ))) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC2 ) && (is_serdes_configured (XFI_FM1_MAC10 )))return PHY_INTERFACE_MODE_XGMII ;if ((port ==FM1_DTSEC10 ) && (is_serdes_configured (XFI_FM1_MAC10 ))) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if (port ==FM1_DTSEC3 ) if ((rcwsr13 & FSL_CHASSIS2_RCWSR13_EC1) ==
@@ -118,5 +118,5 @@ phy_interface_t fman_port_enet_if(enum fm_port port)break ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }
drivers/net/fm/p1023.c +2 -2
@@ -46,7 +46,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 pordevsr =in_be32 (&gur->pordevsr);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;/* DTSEC1 can be SGMII, RGMII or RMII */ if (port ==FM1_DTSEC1 ) {
@@ -68,5 +68,5 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_RGMII ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }
drivers/net/fm/p4080.c +3 -3
@@ -54,7 +54,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr11 =in_be32 (&gur->rcwsr[11 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC1 ) && (is_serdes_configured (XAUI_FM1 )))return PHY_INTERFACE_MODE_XGMII ;
@@ -91,8 +91,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_SGMII ;break ;default : -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }
drivers/net/fm/p5020.c +3 -3
@@ -50,7 +50,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr11 =in_be32 (&gur->rcwsr[11 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC1 ) && (is_serdes_configured (XAUI_FM1 )))return PHY_INTERFACE_MODE_XGMII ;
@@ -82,8 +82,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_SGMII ;break ;default : -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }
drivers/net/fm/p5040.c +3 -3
@@ -56,7 +56,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr11 =in_be32 (&gur->rcwsr[11 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC1 ) && (is_serdes_configured (XAUI_FM1 )))return PHY_INTERFACE_MODE_XGMII ;
@@ -99,8 +99,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_SGMII ;break ;default : -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }
drivers/net/fm/t1024.c +2 -2
@@ -39,7 +39,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr13 =in_be32 (&gur->rcwsr[13 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC1 ) && (is_serdes_configured (XFI_FM1_MAC1 )))return PHY_INTERFACE_MODE_XGMII ;
@@ -83,5 +83,5 @@ phy_interface_t fman_port_enet_if(enum fm_port port)break ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }
drivers/net/fm/t1040.c +2 -2
@@ -56,8 +56,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_SGMII ;break ;default : -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }
drivers/net/fm/t2080.c +3 -3
@@ -47,7 +47,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr13 =in_be32 (&gur->rcwsr[13 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; if ((port == FM1_10GEC1 || port == FM1_10GEC2) && ((is_serdes_configured(XAUI_FM1_MAC9)) ||
@@ -85,8 +85,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_SGMII ;break ;default : -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }
drivers/net/fm/t4240.c +3 -3
@@ -61,7 +61,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr13 =in_be32 (&gur->rcwsr[13 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; if ((port == FM1_10GEC1 || port == FM1_10GEC2) && ((is_serdes_configured(XAUI_FM1_MAC9)) ||
@@ -73,7 +73,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)if ((port ==FM1_DTSEC9 || port ==FM1_DTSEC10 ) && ((is_serdes_configured (XFI_FM1_MAC9 )) || (is_serdes_configured (XFI_FM1_MAC10 )))) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; if ((port == FM2_10GEC1 || port == FM2_10GEC2) && ((is_serdes_configured(XAUI_FM2_MAC9)) ||
@@ -166,5 +166,5 @@ phy_interface_t fman_port_enet_if(enum fm_port port)break ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }
drivers/net/fsl_enetc.c +1 -1
@@ -277,7 +277,7 @@ static void enetc_start_pcs(struct udevice *dev) } priv->if_type =dev_read_phy_mode (dev); -if (priv->if_type ==PHY_INTERFACE_MODE_NONE ) { +if (priv->if_type ==PHY_INTERFACE_MODE_NA ) {enetc_dbg (dev,"phy-mode property not found, defaulting to SGMII\n" ); priv->if_type =PHY_INTERFACE_MODE_SGMII ;
drivers/net/ftgmac100.c +1 -1
@@ -553,7 +553,7 @@ static int ftgmac100_of_to_plat(struct udevice *dev) pdata->iobase =dev_read_addr (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; pdata->max_speed =dev_read_u32_default (dev,"max-speed" ,0 );
drivers/net/higmacv300.c +1 -1
@@ -567,7 +567,7 @@ static int higmac_of_to_plat(struct udevice *dev) priv->macif_ctrl =dev_remap_addr_index (dev,1 ); priv->phyintf =dev_read_phy_mode (dev); -if (priv->phyintf ==PHY_INTERFACE_MODE_NONE ) +if (priv->phyintf ==PHY_INTERFACE_MODE_NA )return -ENODEV ; phy_node =dev_read_subnode (dev,"phy" );
drivers/net/ldpaa_eth/ldpaa_eth.c +1 -1
@@ -1127,7 +1127,7 @@ static int ldpaa_eth_bind(struct udevice *dev)int phy_mode =-1 ; phy_mode =dev_read_phy_mode (dev); -if (phy_mode ==PHY_INTERFACE_MODE_NONE ) { +if (phy_mode ==PHY_INTERFACE_MODE_NA ) {dev_err (dev,"incorrect phy mode\n" );return -EINVAL ; }
drivers/net/ldpaa_eth/ldpaa_wriop.c +5 -5
@@ -16,7 +16,7 @@ struct wriop_dpmac_info dpmac_info[NUM_WRIOP_PORTS];__weak phy_interface_t wriop_dpmac_enet_if (int dpmac_id,int lane_prtc) { -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }void wriop_init_dpmac (int sd,int dpmac_id,int lane_prtcl)
@@ -26,10 +26,10 @@ void wriop_init_dpmac(int sd, int dpmac_id, int lane_prtcl) dpmac_info[dpmac_id].enabled =0 ; dpmac_info[dpmac_id].id =0 ; - dpmac_info[dpmac_id].enet_if =PHY_INTERFACE_MODE_NONE ; + dpmac_info[dpmac_id].enet_if =PHY_INTERFACE_MODE_NA ; enet_if =wriop_dpmac_enet_if (dpmac_id, lane_prtcl); -if (enet_if !=PHY_INTERFACE_MODE_NONE ) { +if (enet_if !=PHY_INTERFACE_MODE_NA ) { dpmac_info[dpmac_id].enabled =1 ; dpmac_info[dpmac_id].id = dpmac_id; dpmac_info[dpmac_id].enet_if = enet_if;
@@ -183,10 +183,10 @@ phy_interface_t wriop_get_enet_if(int dpmac_id)int i =wriop_dpmac_to_index (dpmac_id);if (i ==-1 ) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if (dpmac_info[i].enabled)return dpmac_info[i].enet_if; -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }
drivers/net/ldpaa_eth/ls1088a.c +2 -2
@@ -50,7 +50,7 @@ phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl)enum srds_prtcl ;if (is_device_disabled (dpmac_id +1 )) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;switch (lane_prtcl) {case SGMII1 :
@@ -66,7 +66,7 @@ phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl)if (lane_prtcl >=QSGMII_A && lane_prtcl <=QSGMII_B )return PHY_INTERFACE_MODE_QSGMII ; -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }void wriop_init_dpmac_qsgmii (int sd,int lane_prtcl)
drivers/net/ldpaa_eth/ls2080a.c +2 -2
@@ -62,7 +62,7 @@ phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl)enum srds_prtcl ;if (is_device_disabled (dpmac_id +1 )) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if (lane_prtcl >=SGMII1 && lane_prtcl <=SGMII16 )return PHY_INTERFACE_MODE_SGMII ;
@@ -76,7 +76,7 @@ phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl)if (lane_prtcl >=QSGMII_A && lane_prtcl <=QSGMII_D )return PHY_INTERFACE_MODE_QSGMII ; -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }void wriop_init_dpmac_qsgmii (int sd,int lane_prtcl)
drivers/net/ldpaa_eth/lx2160a.c +2 -2
@@ -58,7 +58,7 @@ phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl)enum srds_prtcl ;if (is_device_disabled (dpmac_id)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if (lane_prtcl >=SGMII1 && lane_prtcl <=SGMII18 )return PHY_INTERFACE_MODE_SGMII ;
@@ -78,7 +78,7 @@ phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl)if (lane_prtcl >= _100GE1 && lane_prtcl <= _100GE2)return PHY_INTERFACE_MODE_CAUI4 ; -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }#ifdef CONFIG_SYS_FSL_HAS_RGMII
drivers/net/macb.c +1 -1
@@ -1363,7 +1363,7 @@ static int macb_eth_probe(struct udevice *dev)int ret; macb->phy_interface =dev_read_phy_mode (dev); -if (macb->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (macb->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;/* Read phyaddr from DT */
drivers/net/mscc_eswitch/jr2_switch.c +1 -1
@@ -954,7 +954,7 @@ static int jr2_probe(struct udevice *dev) phy =phy_connect (priv->ports[i].bus, priv->ports[i].phy_addr, dev, -PHY_INTERFACE_MODE_NONE ); +PHY_INTERFACE_MODE_NA );if (phy)board_phy_config (phy); }
drivers/net/mscc_eswitch/luton_switch.c +1 -1
@@ -685,7 +685,7 @@ static int luton_probe(struct udevice *dev) phy =phy_connect (priv->ports[i].bus, priv->ports[i].phy_addr, dev, -PHY_INTERFACE_MODE_NONE ); +PHY_INTERFACE_MODE_NA );if (phy && i >=MAX_INT_PORT )board_phy_config (phy); }
drivers/net/mscc_eswitch/ocelot_switch.c +1 -1
@@ -608,7 +608,7 @@ static int ocelot_probe(struct udevice *dev) phy =phy_connect (priv->ports[i].bus, priv->ports[i].phy_addr, dev, -PHY_INTERFACE_MODE_NONE ); +PHY_INTERFACE_MODE_NA );if (phy &&external_bus (priv, i))board_phy_config (phy); }
drivers/net/mscc_eswitch/serval_switch.c +1 -1
@@ -561,7 +561,7 @@ static int serval_probe(struct udevice *dev) phy =phy_connect (priv->ports[i].bus, priv->ports[i].phy_addr, dev, -PHY_INTERFACE_MODE_NONE ); +PHY_INTERFACE_MODE_NA );if (phy)board_phy_config (phy); }
drivers/net/mscc_eswitch/servalt_switch.c +1 -1
@@ -482,7 +482,7 @@ static int servalt_probe(struct udevice *dev)continue ;phy_connect (priv->ports[i].bus, priv->ports[i].phy_addr, dev, -PHY_INTERFACE_MODE_NONE ); +PHY_INTERFACE_MODE_NA ); }return 0 ;
drivers/net/mt7620-eth.c +6 -6
@@ -596,7 +596,7 @@ static int mt7620_setup_gmac_mode(struct mt7620_eth_priv *priv, u32 gmac,case PHY_INTERFACE_MODE_RGMII : ge_mode =MT7620_SYSC_GE_RGMII ;break ; -case PHY_INTERFACE_MODE_NONE : +case PHY_INTERFACE_MODE_NA :if (gmac ==2 ) ge_mode =MT7620_SYSC_GE_ESW_PHY ;else
@@ -620,7 +620,7 @@ static void mt7620_gsw_setup_port(struct mt7620_eth_priv *priv, u32 port, {u32 pmcr; -if (port_cfg->mode ==PHY_INTERFACE_MODE_NONE ) { +if (port_cfg->mode ==PHY_INTERFACE_MODE_NA ) {if (port ==5 ) {gsw_write (priv,GSW_PMCR (port),FORCE_MODE );return ;
@@ -666,7 +666,7 @@ static void mt7620_gsw_setup_phy_polling(struct mt7620_eth_priv *priv) {int phy_addr_st, phy_addr_end; -if (priv->port_cfg[0 ].mode ==PHY_INTERFACE_MODE_NONE ) +if (priv->port_cfg[0 ].mode ==PHY_INTERFACE_MODE_NA ) priv->ephy_num =NUM_FE_PHYS ;else priv->ephy_num =NUM_FE_PHYS -1 ;
@@ -1057,7 +1057,7 @@ static int mt7620_eth_parse_gsw_port(struct mt7620_eth_priv *priv, u32 idx,case PHY_INTERFACE_MODE_MII :case PHY_INTERFACE_MODE_RMII :case PHY_INTERFACE_MODE_RGMII : -case PHY_INTERFACE_MODE_NONE : +case PHY_INTERFACE_MODE_NA :break ;default :dev_err (priv->dev,"mt7620_eth: unsupported phy-mode\n" );
@@ -1128,14 +1128,14 @@ static int mt7620_eth_parse_gsw_cfg(struct udevice *dev)if (ret)return ret; }else { - priv->port_cfg[0 ].mode =PHY_INTERFACE_MODE_NONE ; + priv->port_cfg[0 ].mode =PHY_INTERFACE_MODE_NA ; } subnode =ofnode_find_subnode (dev_ofnode (dev),"port5" );if (ofnode_valid (subnode))return mt7620_eth_parse_gsw_port (priv,1 , subnode); - priv->port_cfg[1 ].mode =PHY_INTERFACE_MODE_NONE ; + priv->port_cfg[1 ].mode =PHY_INTERFACE_MODE_NA ;return 0 ; }
drivers/net/mtk_eth.c +1 -1
@@ -1449,7 +1449,7 @@ static int mtk_eth_of_to_plat(struct udevice *dev)/* Interface mode is required */ pdata->phy_interface =dev_read_phy_mode (dev); priv->phy_interface = pdata->phy_interface; -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) { +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA ) {printf ("error: phy-mode is not set\n" );return -EINVAL ; }
drivers/net/mvgbe.c +1 -1
@@ -1005,7 +1005,7 @@ static int mvgbe_of_to_plat(struct udevice *dev)/* Get phy-mode / phy_interface from DT */ pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA ) pdata->phy_interface =PHY_INTERFACE_MODE_GMII ; dmvgbe->phy_interface = pdata->phy_interface;
drivers/net/mvneta.c +1 -1
@@ -1804,7 +1804,7 @@ static int mvneta_of_to_plat(struct udevice *dev)/* Get phy-mode / phy_interface from DT */ pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;return 0 ;
drivers/net/mvpp2.c +1 -1
@@ -4820,7 +4820,7 @@ static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port) } port->phy_interface =dev_read_phy_mode (dev); -if (port->phy_interface ==PHY_INTERFACE_MODE_NONE ) { +if (port->phy_interface ==PHY_INTERFACE_MODE_NA ) {dev_err (dev,"incorrect phy mode\n" );return -EINVAL ; }
drivers/net/pic32_eth.c +1 -1
@@ -550,7 +550,7 @@ static int pic32_eth_probe(struct udevice *dev)/* get phy mode */ pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;/* get phy addr */
drivers/net/qe/dm_qe_uec.c +1 -1
@@ -1137,7 +1137,7 @@ static int qe_uec_of_to_plat(struct udevice *dev) pdata->iobase = (phys_addr_t )devfdt_get_addr (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;return 0 ;
drivers/net/ravb.c +1 -1
@@ -679,7 +679,7 @@ int ravb_of_to_plat(struct udevice *dev) pdata->iobase =dev_read_addr (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; pdata->max_speed =1000 ;
drivers/net/sh_eth.c +1 -1
@@ -920,7 +920,7 @@ int sh_ether_of_to_plat(struct udevice *dev) pdata->iobase =dev_read_addr (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; pdata->max_speed =1000 ;
drivers/net/sni_ave.c +1 -1
@@ -749,7 +749,7 @@ static int ave_of_to_plat(struct udevice *dev) pdata->iobase =dev_read_addr (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; pdata->max_speed =0 ;
drivers/net/sni_netsec.c +1 -1
@@ -1034,7 +1034,7 @@ static int netsec_of_to_plat(struct udevice *dev) priv->eeprom_base =dev_read_addr_index (dev,1 ) -EERPROM_MAP_OFFSET ; pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; if (!dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
drivers/net/sun8i_emac.c +1 -1
@@ -947,7 +947,7 @@ static int sun8i_emac_eth_of_to_plat(struct udevice *dev) pdata->phy_interface =dev_read_phy_mode (dev);printf ("phy interface%d\n" , pdata->phy_interface); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;if (priv->variant ==H3_EMAC ) {
drivers/net/ti/am65-cpsw-nuss.c +1 -1
@@ -607,7 +607,7 @@ static int am65_cpsw_ofdata_parse_phy(struct udevice *dev)dev_read_u32 (dev,"reg" , &priv->port_id); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) { +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA ) {dev_err (dev,"Invalid PHY mode, port %u\n" , priv->port_id);return -EINVAL ; }
drivers/net/ti/cpsw.c +1 -1
@@ -1345,7 +1345,7 @@ static int cpsw_eth_of_to_plat(struct udevice *dev) } pdata->phy_interface = data->slave_data[data->active_slave].phy_if; -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;return 0 ;
drivers/net/ti/keystone_net.c +1 -1
@@ -728,7 +728,7 @@ static int ks2_eth_parse_slave_interface(int netcp, int slave, priv->has_mdio = true; }else if (priv->link_type ==LINK_TYPE_RGMII_LINK_MAC_PHY ) { priv->phy_if =ofnode_read_phy_mode (offset_to_ofnode (slave)); -if (priv->phy_if ==PHY_INTERFACE_MODE_NONE ) +if (priv->phy_if ==PHY_INTERFACE_MODE_NA ) priv->phy_if =PHY_INTERFACE_MODE_RGMII ; pdata->phy_interface = priv->phy_if;
drivers/net/tsec.c +1 -1
@@ -894,7 +894,7 @@ int tsec_probe(struct udevice *dev) priv->tbiaddr = tbiaddr; pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA ) pdata->phy_interface =tsec_get_interface (priv); priv->interface = pdata->phy_interface;
drivers/net/xilinx_axi_emac.c +1 -1
@@ -850,7 +850,7 @@ static int axi_emac_of_to_plat(struct udevice *dev) } pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; plat->eth_hasnobuf = fdtdec_get_bool(gd->fdt_blob, node,
drivers/net/zynq_gem.c +1 -1
@@ -859,7 +859,7 @@ static int zynq_gem_of_to_plat(struct udevice *dev) } pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; priv->interface = pdata->phy_interface;
include/dm/ofnode.h +1 -1
@@ -1226,7 +1226,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);
include/dm/read.h +1 -1
@@ -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);
include/fm_eth.h +1 -1
@@ -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) \
include/phy_interface.h +4 -4
@@ -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]; }
include/vsc9953.h +1 -1
@@ -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, \ }
net/mdio-uclass.c +2 -2
@@ -199,8 +199,8 @@ struct phy_device *dm_eth_phy_connect(struct udevice *ethdev) } interface =dev_read_phy_mode (ethdev); -if (interface ==PHY_INTERFACE_MODE_NONE ) -dev_dbg (ethdev,"can't find interface mode, default to NONE\n" ); +if (interface ==PHY_INTERFACE_MODE_NA ) +dev_dbg (ethdev,"can't find interface mode, default to NA\n" ); phy =dm_eth_connect_phy_handle (ethdev, interface);
Signature · 1 line
2.34.1
PATCH 12/14 net: phy: use ->is_c45 instead of is_10g_interface()
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
Use phydev->is_c45 instead of is_10g_interface(phydev->interface) to determine whether clause 45 protocol should be used.
--- drivers/net/phy/phy.c | 8 ++++---- include/phy.h | 12 ------------ 2 files changed, 4 insertions(+), 16 deletions(-)
drivers/net/phy/phy.c +4 -4
@@ -632,10 +632,10 @@ static int phy_probe(struct phy_device *phydev)return err; } -static struct phy_driver *generic_for_interface (phy_interface_t interface) +static struct phy_driver *generic_for_phy (struct phy_device *phydev) {#ifdef CONFIG_PHYLIB_10G -if (is_10g_interface (interface)) +if (phydev->is_c45)return &gen10g_driver;#endif
@@ -656,7 +656,7 @@ static struct phy_driver *get_phy_driver(struct phy_device *phydev, }/* If we made it here, there's no driver for this PHY */ -return generic_for_interface (interface); +return generic_for_phy (phydev); } static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
@@ -859,7 +859,7 @@ int phy_reset(struct phy_device *phydev)#ifdef CONFIG_PHYLIB_10G /* If it's 10G, we need to issue reset through one of the MMDs */ -if (is_10g_interface (phydev->interface)) { +if (phydev->is_c45) {if (!phydev->mmds)gen10g_discover_mmds (phydev);
include/phy.h +0 -12
@@ -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 /**
Signature · 1 line
2.34.1
PATCH 14/14 net: phy: don't require PHY interface mode during PHY creation
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
Currently we require PHY interface mode to be known when finding/creating the PHY - the functions
* phy_device_create()
* create_phy_by_mask()
* search_for_existing_phy()
* get_phy_device_by_mask()
* phy_find_by_mask() (this is the only one global)
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.
--- board/CZ.NIC/turris_mox/turris_mox.c | 2 +- board/boundary/nitrogen6x/nitrogen6x.c | 2 +- board/gdsys/a38x/controlcenterdc.c | 7 ++- board/gdsys/a38x/ihs_phys.c | 6 +- drivers/net/altera_tse.c | 4 +- drivers/net/ethoc.c | 4 +- drivers/net/fec_mxc.c | 4 +- drivers/net/pch_gbe.c | 4 +- drivers/net/phy/phy.c | 86 +++++++++++--------------- drivers/net/phy/xilinx_gmii2rgmii.c | 4 +- drivers/net/ravb.c | 4 +- drivers/net/sh_eth.c | 4 +- drivers/net/sni_ave.c | 4 +- drivers/net/sunxi_emac.c | 5 +- include/_exports.h | 3 +- include/exports.h | 3 +- include/phy.h | 12 ++-- 17 files changed, 72 insertions(+), 86 deletions(-)
board/CZ.NIC/turris_mox/turris_mox.c +1 -1
@@ -396,7 +396,7 @@ static void mox_phy_leds_start_blinking(void)return ; } - phydev =phy_find_by_mask (bus,BIT (1 ),PHY_INTERFACE_MODE_RGMII ); + phydev =phy_find_by_mask (bus,BIT (1 ));if (!phydev) {printf ("Cannot get ethernet PHY!\n" );return ;
board/boundary/nitrogen6x/nitrogen6x.c +1 -1
@@ -345,7 +345,7 @@ int board_eth_init(struct bd_info *bis)if (!bus)return -EINVAL ;/* scan phy 4,5,6,7 */ - phydev =phy_find_by_mask (bus, (0xf <<4 ),PHY_INTERFACE_MODE_RGMII ); + phydev =phy_find_by_mask (bus, (0xf <<4 ));if (!phydev) { ret = -EINVAL ; goto free_bus;
board/gdsys/a38x/controlcenterdc.c +4 -3
@@ -194,11 +194,12 @@ void init_host_phys(struct mii_dev *bus)for (k =0 ; k <2 ; ++k) {struct phy_device *phydev; - phydev =phy_find_by_mask (bus,1 << k, -PHY_INTERFACE_MODE_SGMII ); + phydev =phy_find_by_mask (bus,1 << k); -if (phydev) +if (phydev) { + phydev->interface =PHY_INTERFACE_MODE_SGMII ;phy_config (phydev); + } } }
board/gdsys/a38x/ihs_phys.c +3 -3
@@ -28,6 +28,7 @@ static void ihs_phy_config(struct phy_device *phydev, bool qinpn, bool qoutpn) {u16 reg; + phydev->interface =PHY_INTERFACE_MODE_MII ;phy_config (phydev);/* enable QSGMII autonegotiation with flow control */
@@ -142,10 +143,9 @@ struct porttype *get_porttype(uint octo_phy_mask, uint k)int init_single_phy (struct porttype *porttype,struct mii_dev *bus,uint bus_idx,uint m,uint phy_idx) { -struct phy_device *phydev =phy_find_by_mask ( - bus,1 << (m *8 + phy_idx), -PHY_INTERFACE_MODE_MII ); +struct phy_device *phydev; + phydev =phy_find_by_mask (bus,BIT (m *8 + phy_idx));printf (" %u" , bus_idx *32 + m *8 + phy_idx);if (!phydev)
drivers/net/altera_tse.c +2 -2
@@ -435,11 +435,11 @@ static int tse_phy_init(struct altera_tse_priv *priv, void *dev)if (priv->phyaddr) mask =1 << priv->phyaddr; - phydev =phy_find_by_mask (priv->bus, mask, priv->interface); + phydev =phy_find_by_mask (priv->bus, mask);if (!phydev)return -ENODEV ; -phy_connect_dev (phydev, dev); +phy_connect_dev (phydev, dev, priv->interface); phydev->supported &=PHY_GBIT_FEATURES ; phydev->advertising = phydev->supported;
drivers/net/ethoc.c +2 -2
@@ -614,11 +614,11 @@ static int ethoc_phy_init(struct ethoc *priv, void *dev) mask =1 <<CONFIG_PHY_ADDR ;#endif - phydev =phy_find_by_mask (priv->bus, mask,PHY_INTERFACE_MODE_MII ); + phydev =phy_find_by_mask (priv->bus, mask);if (!phydev)return -ENODEV ; -phy_connect_dev (phydev, dev); +phy_connect_dev (phydev, dev,PHY_INTERFACE_MODE_MII ); phydev->supported &=PHY_BASIC_FEATURES ; phydev->advertising = phydev->supported;
drivers/net/fec_mxc.c +2 -2
@@ -1172,7 +1172,7 @@ static int fec_probe(struct bd_info *bd, int dev_id, uint32_t base_addr,fec_mii_setspeed (bus->priv);#ifdef CONFIG_PHYLIB fec->phydev = phydev; -phy_connect_dev (phydev, edev); +phy_connect_dev (phydev, edev,PHY_INTERFACE_MODE_RGMII );/* Configure phy */ phy_config (phydev);#else
@@ -1234,7 +1234,7 @@ int fecmxc_initialize_multi(struct bd_info *bd, int dev_id, int phy_id,if (!bus)return -ENOMEM ;#ifdef CONFIG_PHYLIB - phydev =phy_find_by_mask (bus,1 << phy_id,PHY_INTERFACE_MODE_RGMII ); + phydev =phy_find_by_mask (bus,1 << phy_id);if (!phydev) {mdio_unregister (bus);free (bus);
drivers/net/pch_gbe.c +2 -2
@@ -416,13 +416,13 @@ static int pch_gbe_phy_init(struct udevice *dev)struct phy_device *phydev;int mask =0xffffffff ; - phydev =phy_find_by_mask (priv->bus, mask, plat->phy_interface); + phydev =phy_find_by_mask (priv->bus, mask);if (!phydev) {printf ("pch_gbe: cannot find the phy\n" );return -1 ; } -phy_connect_dev (phydev, dev); +phy_connect_dev (phydev, dev, plat->phy_interface); phydev->supported &=PHY_GBIT_FEATURES ; phydev->advertising = phydev->supported;
drivers/net/phy/phy.c +36 -50
230 lines not on this page · raw message
drivers/net/phy/xilinx_gmii2rgmii.c +2 -2
@@ -42,13 +42,13 @@ static int xilinxgmiitorgmii_config(struct phy_device *phydev) ext_phyaddr =ofnode_read_u32_default (phandle.node,"reg" ,-1 ); ext_phydev =phy_find_by_mask (phydev->bus, -1 << ext_phyaddr, -PHY_INTERFACE_MODE_RGMII ); +1 << ext_phyaddr);if (!ext_phydev) {printf ("%s, No external phy device found\n" , __func__);return -EINVAL ; } + ext_phydev->interface =PHY_INTERFACE_MODE_RGMII ; ext_phydev->node = phandle.node; phydev->priv = ext_phydev;
drivers/net/ravb.c +2 -2
@@ -319,11 +319,11 @@ static int ravb_phy_config(struct udevice *dev)mdelay (1 ); } - phydev =phy_find_by_mask (eth->bus, mask, pdata->phy_interface); + phydev =phy_find_by_mask (eth->bus, mask);if (!phydev)return -ENODEV ; -phy_connect_dev (phydev, dev); +phy_connect_dev (phydev, dev, pdata->phy_interface); eth->phydev = phydev;
drivers/net/sh_eth.c +2 -2
@@ -762,11 +762,11 @@ static int sh_eth_phy_config(struct udevice *dev)struct phy_device *phydev;int mask =0xffffffff ; - phydev =phy_find_by_mask (priv->bus, mask, pdata->phy_interface); + phydev =phy_find_by_mask (priv->bus, mask);if (!phydev)return -ENODEV ; -phy_connect_dev (phydev, dev); +phy_connect_dev (phydev, dev, pdata->phy_interface); port_info->phydev = phydev;phy_config (phydev);
drivers/net/sni_ave.c +2 -2
@@ -393,11 +393,11 @@ static int ave_phy_init(struct ave_private *priv, void *dev)struct phy_device *phydev;int mask =GENMASK (31 ,0 ), ret; - phydev =phy_find_by_mask (priv->bus, mask, priv->phy_mode); + phydev =phy_find_by_mask (priv->bus, mask);if (!phydev)return -ENODEV ; -phy_connect_dev (phydev, dev); +phy_connect_dev (phydev, dev, priv->phy_mode); phydev->supported &=PHY_GBIT_FEATURES ;if (priv->max_speed) {
drivers/net/sunxi_emac.c +2 -3
@@ -272,12 +272,11 @@ static int sunxi_emac_init_phy(struct emac_eth_dev *priv, void *dev)if (ret)return ret; - priv->phydev =phy_find_by_mask (priv->bus, mask, -PHY_INTERFACE_MODE_MII ); + priv->phydev =phy_find_by_mask (priv->bus, mask);if (!priv->phydev)return -ENODEV ; -phy_connect_dev (priv->phydev, dev); +phy_connect_dev (priv->phydev, dev,PHY_INTERFACE_MODE_MII );phy_config (priv->phydev);return 0 ;
include/_exports.h +1 -2
@@ -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,
include/exports.h +1 -2
@@ -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
include/phy.h +7 -5
@@ -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
@@ -456,8 +456,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
Signature · 1 line
2.34.1
Re: [PATCH u-boot-net 08/14] treewide: Rename PHY_INTERFACE_MODE_COUNT to PHY_INTERFACE_MODE_MAX
In reply to Marek BehúnQuoted 6 lines · Marek Behún
From: Marek Behún <[email protected]>
Rename constant
PHY_INTERFACE_MODE_COUNTtoPHY_INTERFACE_MODE_MAXto make it compatible with Linux' naming.Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 37 lines
--- drivers/core/ofnode.c | 2 +- drivers/net/phy/aquantia.c | 2 +- include/phy_interface.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)drivers/core/ofnode.c +1
-1@@ -1198,7 +1198,7 @@ phy_interface_t ofnode_read_phy_mode(ofnode node)if (!mode)return PHY_INTERFACE_MODE_NONE ; -for (i =0 ; i <PHY_INTERFACE_MODE_COUNT ; i++) +for (i =0 ; i <PHY_INTERFACE_MODE_MAX ; i++)if (!strcmp (mode, phy_interface_strings[i]))return i;drivers/net/phy/aquantia.c +1
-1@@ -305,7 +305,7 @@ struct {u16 syscfg;int cnt;u16 start_rate; -} aquantia_syscfg[PHY_INTERFACE_MODE_COUNT] = { +} aquantia_syscfg[PHY_INTERFACE_MODE_MAX] = { [PHY_INTERFACE_MODE_SGMII] = {0x04b, AQUANTIA_VND1_GSYSCFG_1G, AQUANTIA_VND1_GSTART_RATE_1G}, [PHY_INTERFACE_MODE_2500BASEX] = {0x144, AQUANTIA_VND1_GSYSCFG_2_5G,include/phy_interface.h +0
-0
include/phy_interface.h typedef enum { · line 47
Quoted 8 lines
include/phy_interface.h +1
-1@@ -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[] = {
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
Re: [PATCH u-boot-net 09/14] treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA
In reply to Marek BehúnQuoted 6 lines · Marek Behún
From: Marek Behún <[email protected]>
Rename constant
PHY_INTERFACE_MODE_NONEtoPHY_INTERFACE_MODE_NAto make it compatible with Linux' naming.Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 1,155 lines
--- board/freescale/corenet_ds/eth_hydra.c | 2 +- board/freescale/corenet_ds/eth_superhydra.c | 4 ++-- board/freescale/t104xrdb/eth.c | 4 ++-- drivers/core/ofnode.c | 4 ++-- drivers/net/ag7xxx.c | 2 +- drivers/net/altera_tse.c | 2 +- drivers/net/bcm6348-eth.c | 2 +- drivers/net/bcmgenet.c | 2 +- drivers/net/designware.c | 2 +- drivers/net/dwc_eth_qos.c | 4 ++-- drivers/net/fec_mxc.c | 2 +- drivers/net/fm/b4860.c | 8 ++++---- drivers/net/fm/init.c | 8 ++++---- drivers/net/fm/ls1043.c | 6 +++--- drivers/net/fm/ls1046.c | 8 ++++---- drivers/net/fm/p1023.c | 4 ++-- drivers/net/fm/p4080.c | 6 +++--- drivers/net/fm/p5020.c | 6 +++--- drivers/net/fm/p5040.c | 6 +++--- drivers/net/fm/t1024.c | 4 ++-- drivers/net/fm/t1040.c | 4 ++-- drivers/net/fm/t2080.c | 6 +++--- drivers/net/fm/t4240.c | 6 +++--- drivers/net/fsl_enetc.c | 2 +- drivers/net/ftgmac100.c | 2 +- drivers/net/higmacv300.c | 2 +- drivers/net/ldpaa_eth/ldpaa_eth.c | 2 +- drivers/net/ldpaa_eth/ldpaa_wriop.c | 10 +++++----- drivers/net/ldpaa_eth/ls1088a.c | 4 ++-- drivers/net/ldpaa_eth/ls2080a.c | 4 ++-- drivers/net/ldpaa_eth/lx2160a.c | 4 ++-- drivers/net/macb.c | 2 +- drivers/net/mscc_eswitch/jr2_switch.c | 2 +- drivers/net/mscc_eswitch/luton_switch.c | 2 +- drivers/net/mscc_eswitch/ocelot_switch.c | 2 +- drivers/net/mscc_eswitch/serval_switch.c | 2 +- drivers/net/mscc_eswitch/servalt_switch.c | 2 +- drivers/net/mt7620-eth.c | 12 ++++++------ drivers/net/mtk_eth.c | 2 +- drivers/net/mvgbe.c | 2 +- drivers/net/mvneta.c | 2 +- drivers/net/mvpp2.c | 2 +- drivers/net/pic32_eth.c | 2 +- drivers/net/qe/dm_qe_uec.c | 2 +- drivers/net/ravb.c | 2 +- drivers/net/sh_eth.c | 2 +- drivers/net/sni_ave.c | 2 +- drivers/net/sni_netsec.c | 2 +- drivers/net/sun8i_emac.c | 2 +- drivers/net/ti/am65-cpsw-nuss.c | 2 +- drivers/net/ti/cpsw.c | 2 +- drivers/net/ti/keystone_net.c | 2 +- drivers/net/tsec.c | 2 +- drivers/net/xilinx_axi_emac.c | 2 +- drivers/net/zynq_gem.c | 2 +- include/dm/ofnode.h | 2 +- include/dm/read.h | 2 +- include/fm_eth.h | 2 +- include/phy_interface.h | 8 ++++---- include/vsc9953.h | 2 +- net/mdio-uclass.c | 4 ++-- 61 files changed, 105 insertions(+), 105 deletions(-)board/freescale/corenet_ds/eth_hydra.c +1
-1@@ -471,7 +471,7 @@ int board_eth_init(struct bd_info *bis)fm_info_set_mdio (i,miiphy_get_dev_by_name ("HYDRA_RGMII_MDIO" ));break ; -case PHY_INTERFACE_MODE_NONE : +case PHY_INTERFACE_MODE_NA :fm_info_set_phy_address (i,0 );break ;default :board/freescale/corenet_ds/eth_superhydra.c +2
-2@@ -583,7 +583,7 @@ int board_eth_init(struct bd_info *bis)fm_info_set_mdio (i,miiphy_get_dev_by_name ("SUPER_HYDRA_RGMII_MDIO" ));break ; -case PHY_INTERFACE_MODE_NONE : +case PHY_INTERFACE_MODE_NA :fm_info_set_phy_address (i,0 );break ;default :@@ -733,7 +733,7 @@ int board_eth_init(struct bd_info *bis)fm_info_set_mdio (i,miiphy_get_dev_by_name ("SUPER_HYDRA_RGMII_MDIO" ));break ; -case PHY_INTERFACE_MODE_NONE : +case PHY_INTERFACE_MODE_NA :fm_info_set_phy_address (i,0 );break ;default :board/freescale/t104xrdb/eth.c +2
-2@@ -89,7 +89,7 @@ int board_eth_init(struct bd_info *bis)case PHY_INTERFACE_MODE_QSGMII :fm_info_set_phy_address (i,0 );break ; -case PHY_INTERFACE_MODE_NONE : +case PHY_INTERFACE_MODE_NA :fm_info_set_phy_address (i,0 );break ;default :@@ -99,7 +99,7 @@ int board_eth_init(struct bd_info *bis)break ; }if (fm_info_get_enet_if (i) ==PHY_INTERFACE_MODE_QSGMII || -fm_info_get_enet_if (i) ==PHY_INTERFACE_MODE_NONE ) +fm_info_get_enet_if (i) ==PHY_INTERFACE_MODE_NA )fm_info_set_mdio (i,NULL );else fm_info_set_mdio(i,drivers/core/ofnode.c +2
-2@@ -1196,7 +1196,7 @@ phy_interface_t ofnode_read_phy_mode(ofnode node) mode =ofnode_read_string (node,"phy-connection-type" );if (!mode) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;for (i =0 ; i <PHY_INTERFACE_MODE_MAX ; i++)if (!strcmp (mode, phy_interface_strings[i]))@@ -1204,5 +1204,5 @@ phy_interface_t ofnode_read_phy_mode(ofnode node)debug ("%s: Invalid PHY interface '%s'\n" , __func__, mode); -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/ag7xxx.c +1
-1@@ -1265,7 +1265,7 @@ static int ag7xxx_eth_of_to_plat(struct udevice *dev)return ret; pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;return 0 ;drivers/net/altera_tse.c +1
-1@@ -678,7 +678,7 @@ static int altera_tse_of_to_plat(struct udevice *dev)struct eth_pdata *pdata =dev_get_plat (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;return 0 ;drivers/net/bcm6348-eth.c +1
-1@@ -425,7 +425,7 @@ static int bcm6348_eth_probe(struct udevice *dev)/* get phy mode */ pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -ENODEV ;/* get phy */ drivers/net/bcmgenet.c +1
-1@@ -696,7 +696,7 @@ static int bcmgenet_eth_of_to_plat(struct udevice *dev)/* Get phy mode from DT */ pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; ret = dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,drivers/net/designware.c +1
-1@@ -921,7 +921,7 @@ int designware_eth_of_to_plat(struct udevice *dev) pdata->iobase =dev_read_addr (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; pdata->max_speed =dev_read_u32_default (dev,"max-speed" ,0 );drivers/net/dwc_eth_qos.c +2
-2@@ -1682,7 +1682,7 @@ static int eqos_probe_resources_stm32(struct udevice *dev) interface = eqos->config->interface (dev); -if (interface ==PHY_INTERFACE_MODE_NONE ) { +if (interface ==PHY_INTERFACE_MODE_NA ) {pr_err ("Invalid PHY interface\n" );return -EINVAL ; }@@ -1743,7 +1743,7 @@ static int eqos_probe_resources_imx(struct udevice *dev) interface = eqos->config->interface (dev); -if (interface ==PHY_INTERFACE_MODE_NONE ) { +if (interface ==PHY_INTERFACE_MODE_NA ) {pr_err ("Invalid PHY interface\n" );return -EINVAL ; }drivers/net/fec_mxc.c +1
-1@@ -1563,7 +1563,7 @@ static int fecmxc_of_to_plat(struct udevice *dev) priv->eth = (struct ethernet_regs *)pdata->iobase; pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;#ifdef CONFIG_DM_REGULATOR drivers/net/fm/b4860.c +4
-4@@ -55,7 +55,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)#endif if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;/*B4860 has two 10Gig Mac*/ if ((port == FM1_10GEC1 || port == FM1_10GEC2) &&@@ -112,7 +112,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port) (port == FM1_DTSEC2) || (port == FM1_DTSEC3) || (port == FM1_DTSEC4)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } } }@@ -131,8 +131,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_SGMII ;break ;default : -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/init.c +4
-4@@ -130,7 +130,7 @@ static int fm_port_to_index(enum fm_port port)/* * Determine if an interface is actually active based on HW config -* we expect fman_port_enet_if() to report PHY_INTERFACE_MODE_NONE if +* we expect fman_port_enet_if() to report PHY_INTERFACE_MODE_NA if * the interface is not active based on HW cfg of the SoC */ void fman_enet_init (void )@@ -141,7 +141,7 @@ void fman_enet_init(void)phy_interface_t enet_if; enet_if =fman_port_enet_if (fm_info[i].port); -if (enet_if !=PHY_INTERFACE_MODE_NONE ) { +if (enet_if !=PHY_INTERFACE_MODE_NA ) { fm_info[i].enabled =1 ; fm_info[i].enet_if = enet_if; }else {@@ -221,12 +221,12 @@ phy_interface_t fm_info_get_enet_if(enum fm_port port)int i =fm_port_to_index (port);if (i ==-1 ) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if (fm_info[i].enabled)return fm_info[i].enet_if; -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } static voiddrivers/net/fm/ls1043.c +3
-3@@ -54,13 +54,13 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr13 =in_be32 (&gur->rcwsr[13 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC1 ) && (is_serdes_configured (XFI_FM1_MAC9 )))return PHY_INTERFACE_MODE_XGMII ;if ((port ==FM1_DTSEC9 ) && (is_serdes_configured (XFI_FM1_MAC9 ))) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if (port ==FM1_DTSEC3 ) if ((rcwsr13 & FSL_CHASSIS2_RCWSR13_EC1) ==@@ -107,5 +107,5 @@ phy_interface_t fman_port_enet_if(enum fm_port port)break ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/ls1046.c +4
-4@@ -54,19 +54,19 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr13 =in_be32 (&gur->rcwsr[13 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC1 ) && (is_serdes_configured (XFI_FM1_MAC9 )))return PHY_INTERFACE_MODE_XGMII ;if ((port ==FM1_DTSEC9 ) && (is_serdes_configured (XFI_FM1_MAC9 ))) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC2 ) && (is_serdes_configured (XFI_FM1_MAC10 )))return PHY_INTERFACE_MODE_XGMII ;if ((port ==FM1_DTSEC10 ) && (is_serdes_configured (XFI_FM1_MAC10 ))) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if (port ==FM1_DTSEC3 ) if ((rcwsr13 & FSL_CHASSIS2_RCWSR13_EC1) ==@@ -118,5 +118,5 @@ phy_interface_t fman_port_enet_if(enum fm_port port)break ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/p1023.c +2
-2@@ -46,7 +46,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 pordevsr =in_be32 (&gur->pordevsr);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;/* DTSEC1 can be SGMII, RGMII or RMII */ if (port ==FM1_DTSEC1 ) {@@ -68,5 +68,5 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_RGMII ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/p4080.c +3
-3@@ -54,7 +54,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr11 =in_be32 (&gur->rcwsr[11 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC1 ) && (is_serdes_configured (XAUI_FM1 )))return PHY_INTERFACE_MODE_XGMII ;@@ -91,8 +91,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_SGMII ;break ;default : -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/p5020.c +3
-3@@ -50,7 +50,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr11 =in_be32 (&gur->rcwsr[11 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC1 ) && (is_serdes_configured (XAUI_FM1 )))return PHY_INTERFACE_MODE_XGMII ;@@ -82,8 +82,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_SGMII ;break ;default : -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/p5040.c +3
-3@@ -56,7 +56,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr11 =in_be32 (&gur->rcwsr[11 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC1 ) && (is_serdes_configured (XAUI_FM1 )))return PHY_INTERFACE_MODE_XGMII ;@@ -99,8 +99,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_SGMII ;break ;default : -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/t1024.c +2
-2@@ -39,7 +39,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr13 =in_be32 (&gur->rcwsr[13 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC1 ) && (is_serdes_configured (XFI_FM1_MAC1 )))return PHY_INTERFACE_MODE_XGMII ;@@ -83,5 +83,5 @@ phy_interface_t fman_port_enet_if(enum fm_port port)break ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/t1040.c +2
-2@@ -56,8 +56,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_SGMII ;break ;default : -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/t2080.c +3
-3@@ -47,7 +47,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr13 =in_be32 (&gur->rcwsr[13 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; if ((port == FM1_10GEC1 || port == FM1_10GEC2) && ((is_serdes_configured(XAUI_FM1_MAC9)) ||@@ -85,8 +85,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_SGMII ;break ;default : -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/t4240.c +3
-3@@ -61,7 +61,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr13 =in_be32 (&gur->rcwsr[13 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; if ((port == FM1_10GEC1 || port == FM1_10GEC2) && ((is_serdes_configured(XAUI_FM1_MAC9)) ||@@ -73,7 +73,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)if ((port ==FM1_DTSEC9 || port ==FM1_DTSEC10 ) && ((is_serdes_configured (XFI_FM1_MAC9 )) || (is_serdes_configured (XFI_FM1_MAC10 )))) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; if ((port == FM2_10GEC1 || port == FM2_10GEC2) && ((is_serdes_configured(XAUI_FM2_MAC9)) ||@@ -166,5 +166,5 @@ phy_interface_t fman_port_enet_if(enum fm_port port)break ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fsl_enetc.c +1
-1@@ -277,7 +277,7 @@ static void enetc_start_pcs(struct udevice *dev) } priv->if_type =dev_read_phy_mode (dev); -if (priv->if_type ==PHY_INTERFACE_MODE_NONE ) { +if (priv->if_type ==PHY_INTERFACE_MODE_NA ) {enetc_dbg (dev,"phy-mode property not found, defaulting to SGMII\n" ); priv->if_type =PHY_INTERFACE_MODE_SGMII ;drivers/net/ftgmac100.c +1
-1@@ -553,7 +553,7 @@ static int ftgmac100_of_to_plat(struct udevice *dev) pdata->iobase =dev_read_addr (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; pdata->max_speed =dev_read_u32_default (dev,"max-speed" ,0 );drivers/net/higmacv300.c +1
-1@@ -567,7 +567,7 @@ static int higmac_of_to_plat(struct udevice *dev) priv->macif_ctrl =dev_remap_addr_index (dev,1 ); priv->phyintf =dev_read_phy_mode (dev); -if (priv->phyintf ==PHY_INTERFACE_MODE_NONE ) +if (priv->phyintf ==PHY_INTERFACE_MODE_NA )return -ENODEV ; phy_node =dev_read_subnode (dev,"phy" );drivers/net/ldpaa_eth/ldpaa_eth.c +1
-1@@ -1127,7 +1127,7 @@ static int ldpaa_eth_bind(struct udevice *dev)int phy_mode =-1 ; phy_mode =dev_read_phy_mode (dev); -if (phy_mode ==PHY_INTERFACE_MODE_NONE ) { +if (phy_mode ==PHY_INTERFACE_MODE_NA ) {dev_err (dev,"incorrect phy mode\n" );return -EINVAL ; }drivers/net/ldpaa_eth/ldpaa_wriop.c +5
-5@@ -16,7 +16,7 @@ struct wriop_dpmac_info dpmac_info[NUM_WRIOP_PORTS];__weak phy_interface_t wriop_dpmac_enet_if (int dpmac_id,int lane_prtc) { -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }void wriop_init_dpmac (int sd,int dpmac_id,int lane_prtcl)@@ -26,10 +26,10 @@ void wriop_init_dpmac(int sd, int dpmac_id, int lane_prtcl) dpmac_info[dpmac_id].enabled =0 ; dpmac_info[dpmac_id].id =0 ; - dpmac_info[dpmac_id].enet_if =PHY_INTERFACE_MODE_NONE ; + dpmac_info[dpmac_id].enet_if =PHY_INTERFACE_MODE_NA ; enet_if =wriop_dpmac_enet_if (dpmac_id, lane_prtcl); -if (enet_if !=PHY_INTERFACE_MODE_NONE ) { +if (enet_if !=PHY_INTERFACE_MODE_NA ) { dpmac_info[dpmac_id].enabled =1 ; dpmac_info[dpmac_id].id = dpmac_id; dpmac_info[dpmac_id].enet_if = enet_if;@@ -183,10 +183,10 @@ phy_interface_t wriop_get_enet_if(int dpmac_id)int i =wriop_dpmac_to_index (dpmac_id);if (i ==-1 ) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if (dpmac_info[i].enabled)return dpmac_info[i].enet_if; -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/ldpaa_eth/ls1088a.c +2
-2@@ -50,7 +50,7 @@ phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl)enum srds_prtcl ;if (is_device_disabled (dpmac_id +1 )) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;switch (lane_prtcl) {case SGMII1 :@@ -66,7 +66,7 @@ phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl)if (lane_prtcl >=QSGMII_A && lane_prtcl <=QSGMII_B )return PHY_INTERFACE_MODE_QSGMII ; -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }void wriop_init_dpmac_qsgmii (int sd,int lane_prtcl)drivers/net/ldpaa_eth/ls2080a.c +2
-2@@ -62,7 +62,7 @@ phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl)enum srds_prtcl ;if (is_device_disabled (dpmac_id +1 )) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if (lane_prtcl >=SGMII1 && lane_prtcl <=SGMII16 )return PHY_INTERFACE_MODE_SGMII ;@@ -76,7 +76,7 @@ phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl)if (lane_prtcl >=QSGMII_A && lane_prtcl <=QSGMII_D )return PHY_INTERFACE_MODE_QSGMII ; -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }void wriop_init_dpmac_qsgmii (int sd,int lane_prtcl)drivers/net/ldpaa_eth/lx2160a.c +2
-2@@ -58,7 +58,7 @@ phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl)enum srds_prtcl ;if (is_device_disabled (dpmac_id)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if (lane_prtcl >=SGMII1 && lane_prtcl <=SGMII18 )return PHY_INTERFACE_MODE_SGMII ;@@ -78,7 +78,7 @@ phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl)if (lane_prtcl >= _100GE1 && lane_prtcl <= _100GE2)return PHY_INTERFACE_MODE_CAUI4 ; -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }#ifdef CONFIG_SYS_FSL_HAS_RGMII drivers/net/macb.c +1
-1@@ -1363,7 +1363,7 @@ static int macb_eth_probe(struct udevice *dev)int ret; macb->phy_interface =dev_read_phy_mode (dev); -if (macb->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (macb->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;/* Read phyaddr from DT */ drivers/net/mscc_eswitch/jr2_switch.c +1
-1@@ -954,7 +954,7 @@ static int jr2_probe(struct udevice *dev) phy =phy_connect (priv->ports[i].bus, priv->ports[i].phy_addr, dev, -PHY_INTERFACE_MODE_NONE ); +PHY_INTERFACE_MODE_NA );if (phy)board_phy_config (phy); }drivers/net/mscc_eswitch/luton_switch.c +1
-1@@ -685,7 +685,7 @@ static int luton_probe(struct udevice *dev) phy =phy_connect (priv->ports[i].bus, priv->ports[i].phy_addr, dev, -PHY_INTERFACE_MODE_NONE ); +PHY_INTERFACE_MODE_NA );if (phy && i >=MAX_INT_PORT )board_phy_config (phy); }drivers/net/mscc_eswitch/ocelot_switch.c +1
-1@@ -608,7 +608,7 @@ static int ocelot_probe(struct udevice *dev) phy =phy_connect (priv->ports[i].bus, priv->ports[i].phy_addr, dev, -PHY_INTERFACE_MODE_NONE ); +PHY_INTERFACE_MODE_NA );if (phy &&external_bus (priv, i))board_phy_config (phy); }drivers/net/mscc_eswitch/serval_switch.c +1
-1@@ -561,7 +561,7 @@ static int serval_probe(struct udevice *dev) phy =phy_connect (priv->ports[i].bus, priv->ports[i].phy_addr, dev, -PHY_INTERFACE_MODE_NONE ); +PHY_INTERFACE_MODE_NA );if (phy)board_phy_config (phy); }drivers/net/mscc_eswitch/servalt_switch.c +1
-1@@ -482,7 +482,7 @@ static int servalt_probe(struct udevice *dev)continue ;phy_connect (priv->ports[i].bus, priv->ports[i].phy_addr, dev, -PHY_INTERFACE_MODE_NONE ); +PHY_INTERFACE_MODE_NA ); }return 0 ;drivers/net/mt7620-eth.c +6
-6@@ -596,7 +596,7 @@ static int mt7620_setup_gmac_mode(struct mt7620_eth_priv *priv, u32 gmac,case PHY_INTERFACE_MODE_RGMII : ge_mode =MT7620_SYSC_GE_RGMII ;break ; -case PHY_INTERFACE_MODE_NONE : +case PHY_INTERFACE_MODE_NA :if (gmac ==2 ) ge_mode =MT7620_SYSC_GE_ESW_PHY ;else @@ -620,7 +620,7 @@ static void mt7620_gsw_setup_port(struct mt7620_eth_priv *priv, u32 port, {u32 pmcr; -if (port_cfg->mode ==PHY_INTERFACE_MODE_NONE ) { +if (port_cfg->mode ==PHY_INTERFACE_MODE_NA ) {if (port ==5 ) {gsw_write (priv,GSW_PMCR (port),FORCE_MODE );return ;@@ -666,7 +666,7 @@ static void mt7620_gsw_setup_phy_polling(struct mt7620_eth_priv *priv) {int phy_addr_st, phy_addr_end; -if (priv->port_cfg[0 ].mode ==PHY_INTERFACE_MODE_NONE ) +if (priv->port_cfg[0 ].mode ==PHY_INTERFACE_MODE_NA ) priv->ephy_num =NUM_FE_PHYS ;else priv->ephy_num =NUM_FE_PHYS -1 ;@@ -1057,7 +1057,7 @@ static int mt7620_eth_parse_gsw_port(struct mt7620_eth_priv *priv, u32 idx,case PHY_INTERFACE_MODE_MII :case PHY_INTERFACE_MODE_RMII :case PHY_INTERFACE_MODE_RGMII : -case PHY_INTERFACE_MODE_NONE : +case PHY_INTERFACE_MODE_NA :break ;default :dev_err (priv->dev,"mt7620_eth: unsupported phy-mode\n" );@@ -1128,14 +1128,14 @@ static int mt7620_eth_parse_gsw_cfg(struct udevice *dev)if (ret)return ret; }else { - priv->port_cfg[0 ].mode =PHY_INTERFACE_MODE_NONE ; + priv->port_cfg[0 ].mode =PHY_INTERFACE_MODE_NA ; } subnode =ofnode_find_subnode (dev_ofnode (dev),"port5" );if (ofnode_valid (subnode))return mt7620_eth_parse_gsw_port (priv,1 , subnode); - priv->port_cfg[1 ].mode =PHY_INTERFACE_MODE_NONE ; + priv->port_cfg[1 ].mode =PHY_INTERFACE_MODE_NA ;return 0 ; }drivers/net/mtk_eth.c +1
-1@@ -1449,7 +1449,7 @@ static int mtk_eth_of_to_plat(struct udevice *dev)/* Interface mode is required */ pdata->phy_interface =dev_read_phy_mode (dev); priv->phy_interface = pdata->phy_interface; -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) { +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA ) {printf ("error: phy-mode is not set\n" );return -EINVAL ; }drivers/net/mvgbe.c +1
-1@@ -1005,7 +1005,7 @@ static int mvgbe_of_to_plat(struct udevice *dev)/* Get phy-mode / phy_interface from DT */ pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA ) pdata->phy_interface =PHY_INTERFACE_MODE_GMII ; dmvgbe->phy_interface = pdata->phy_interface;drivers/net/mvneta.c +1
-1@@ -1804,7 +1804,7 @@ static int mvneta_of_to_plat(struct udevice *dev)/* Get phy-mode / phy_interface from DT */ pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;return 0 ;drivers/net/mvpp2.c +1
-1@@ -4820,7 +4820,7 @@ static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port) } port->phy_interface =dev_read_phy_mode (dev); -if (port->phy_interface ==PHY_INTERFACE_MODE_NONE ) { +if (port->phy_interface ==PHY_INTERFACE_MODE_NA ) {dev_err (dev,"incorrect phy mode\n" );return -EINVAL ; }drivers/net/pic32_eth.c +1
-1@@ -550,7 +550,7 @@ static int pic32_eth_probe(struct udevice *dev)/* get phy mode */ pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;/* get phy addr */ drivers/net/qe/dm_qe_uec.c +1
-1@@ -1137,7 +1137,7 @@ static int qe_uec_of_to_plat(struct udevice *dev) pdata->iobase = (phys_addr_t )devfdt_get_addr (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;return 0 ;drivers/net/ravb.c +1
-1@@ -679,7 +679,7 @@ int ravb_of_to_plat(struct udevice *dev) pdata->iobase =dev_read_addr (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; pdata->max_speed =1000 ;drivers/net/sh_eth.c +1
-1@@ -920,7 +920,7 @@ int sh_ether_of_to_plat(struct udevice *dev) pdata->iobase =dev_read_addr (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; pdata->max_speed =1000 ;drivers/net/sni_ave.c +1
-1@@ -749,7 +749,7 @@ static int ave_of_to_plat(struct udevice *dev) pdata->iobase =dev_read_addr (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; pdata->max_speed =0 ;drivers/net/sni_netsec.c +1
-1@@ -1034,7 +1034,7 @@ static int netsec_of_to_plat(struct udevice *dev) priv->eeprom_base =dev_read_addr_index (dev,1 ) -EERPROM_MAP_OFFSET ; pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; if (!dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,drivers/net/sun8i_emac.c +1
-1@@ -947,7 +947,7 @@ static int sun8i_emac_eth_of_to_plat(struct udevice *dev) pdata->phy_interface =dev_read_phy_mode (dev);printf ("phy interface%d\n" , pdata->phy_interface); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;if (priv->variant ==H3_EMAC ) {drivers/net/ti/am65-cpsw-nuss.c +1
-1@@ -607,7 +607,7 @@ static int am65_cpsw_ofdata_parse_phy(struct udevice *dev)dev_read_u32 (dev,"reg" , &priv->port_id); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) { +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA ) {dev_err (dev,"Invalid PHY mode, port %u\n" , priv->port_id);return -EINVAL ; }drivers/net/ti/cpsw.c +1
-1@@ -1345,7 +1345,7 @@ static int cpsw_eth_of_to_plat(struct udevice *dev) } pdata->phy_interface = data->slave_data[data->active_slave].phy_if; -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;return 0 ;drivers/net/ti/keystone_net.c +1
-1@@ -728,7 +728,7 @@ static int ks2_eth_parse_slave_interface(int netcp, int slave, priv->has_mdio = true; }else if (priv->link_type ==LINK_TYPE_RGMII_LINK_MAC_PHY ) { priv->phy_if =ofnode_read_phy_mode (offset_to_ofnode (slave)); -if (priv->phy_if ==PHY_INTERFACE_MODE_NONE ) +if (priv->phy_if ==PHY_INTERFACE_MODE_NA ) priv->phy_if =PHY_INTERFACE_MODE_RGMII ; pdata->phy_interface = priv->phy_if;drivers/net/tsec.c +1
-1@@ -894,7 +894,7 @@ int tsec_probe(struct udevice *dev) priv->tbiaddr = tbiaddr; pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA ) pdata->phy_interface =tsec_get_interface (priv); priv->interface = pdata->phy_interface;drivers/net/xilinx_axi_emac.c +1
-1@@ -850,7 +850,7 @@ static int axi_emac_of_to_plat(struct udevice *dev) } pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; plat->eth_hasnobuf = fdtdec_get_bool(gd->fdt_blob, node,drivers/net/zynq_gem.c +1
-1@@ -859,7 +859,7 @@ static int zynq_gem_of_to_plat(struct udevice *dev) } pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; priv->interface = pdata->phy_interface;include/dm/ofnode.h +1
-1@@ -1226,7 +1226,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);include/dm/read.h +1
-1@@ -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);include/fm_eth.h +1
-1@@ -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) \include/phy_interface.h +4
-4@@ -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]; }include/vsc9953.h +1
-1@@ -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, \ }net/mdio-uclass.c +0
-0
net/mdio-uclass.c struct phy_device *dm_eth_phy_connect(struct udevice *ethdev) · line 206
Quoted 10 lines
net/mdio-uclass.c +2
-2@@ -199,8 +199,8 @@ struct phy_device *dm_eth_phy_connect(struct udevice *ethdev) } interface =dev_read_phy_mode (ethdev); -if (interface ==PHY_INTERFACE_MODE_NONE ) -dev_dbg (ethdev,"can't find interface mode, default to NONE\n" ); +if (interface ==PHY_INTERFACE_MODE_NA ) +dev_dbg (ethdev,"can't find interface mode, default to NA\n" ); phy =dm_eth_connect_phy_handle (ethdev, interface);
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
Re: [PATCH u-boot-net 10/14] phy: Move PHY_INTERFACE_MODE_NA to the beginning of the enum definition
In reply to Marek BehúnQuoted 7 lines · Marek Behún
From: Marek Behún <[email protected]>
Move
PHY_INTERFACE_MODE_NAto 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.
Quoted 7 lines
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 usePHY_INTERFACE_MODE_MAXfor that now, and so we can move it.Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 31 lines
--- include/phy_interface.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)include/phy_interface.h +2
-2@@ -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_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",
include/phy_interface.h static const char * const phy_interface_strings[] = { · line 76
Quoted 7 lines
include/phy_interface.h +0
-1@@ -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:
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
Re: [PATCH u-boot-net 01/14] net: mdio-uclass: fix type for phy_mode_str and phy_handle_str
In reply to Marek BehúnQuoted 36 lines · Marek Behún
From: Marek Behún <[email protected]>
These global variables should both have type
static const char * constSigned-off-by Marek Behún <[email protected]>--- net/mdio-uclass.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)net/mdio-uclass.c +6
-6@@ -17,13 +17,14 @@/* DT node properties for MAC-PHY interface */ #define PHY_MODE_STR_CNT 2 -static const char *phy_mode_str[PHY_MODE_STR_CNT ] = {"phy-mode" , -"phy-connection-type" }; +static const char *const phy_mode_str[PHY_MODE_STR_CNT ] = { +"phy-mode" ,"phy-connection-type" +};/* DT node properties that reference a PHY node */ #define PHY_HANDLE_STR_CNT 3 -const char *phy_handle_str[PHY_HANDLE_STR_CNT ] = {"phy-handle" , -"phy" , -"phy-device" }; +static const char *const phy_handle_str[PHY_HANDLE_STR_CNT ] = { +"phy-handle" ,"phy" ,"phy-device" +};void dm_mdio_probe_devices (void ) { --
Quoted 2 lines
2.34.1
Re: [PATCH u-boot-net 02/14] net: mdio-uclass: use ARRAY_SIZE()
In reply to Marek BehúnQuoted 5 lines · Marek Behún
From: Marek Behún <[email protected]>
Use the
ARRAY_SIZE()macro instead of hardcoding sizes of arrays in macors.
macros.
Quoted 48 lines
Signed-off-by Marek Behún <[email protected]>--- net/mdio-uclass.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)net/mdio-uclass.c +5
-7@@ -16,13 +16,12 @@#include <linux/compat.h> /* DT node properties for MAC-PHY interface */ -#define PHY_MODE_STR_CNT 2 -static const char *const phy_mode_str[PHY_MODE_STR_CNT ] = { +static const char *const phy_mode_str[] = {"phy-mode" ,"phy-connection-type" }; +/* DT node properties that reference a PHY node */ -#define PHY_HANDLE_STR_CNT 3 -static const char *const phy_handle_str[PHY_HANDLE_STR_CNT ] = { +static const char *const phy_handle_str[] = {"phy-handle" ,"phy" ,"phy-device" };@@ -149,7 +148,7 @@ static struct phy_device *dm_eth_connect_phy_handle(struct udevice *ethdev, goto out; } -for (i =0 ; i <PHY_HANDLE_STR_CNT ; i++) +for (i =0 ; i <ARRAY_SIZE (phy_handle_str); i++)if (!dev_read_phandle_with_args (ethdev, phy_handle_str[i],NULL ,0 ,0 , &phandle))break ;@@ -199,7 +198,7 @@ struct phy_device *dm_eth_phy_connect(struct udevice *ethdev) } interface =PHY_INTERFACE_MODE_NONE ; -for (i =0 ; i <PHY_MODE_STR_CNT ; i++) { +for (i =0 ; i <ARRAY_SIZE (phy_mode_str); i++) { if_str =dev_read_string (ethdev, phy_mode_str[i]);if (if_str) { interface =phy_get_interface_by_name (if_str); --2.34.1
Re: [PATCH u-boot-net 04/14] net: mdio-uclass: add wrappers for read/write/reset operations
In reply to Marek BehúnQuoted 97 lines · Marek Behún
From: Marek Behún <[email protected]>
Add wrappers
dm_mdio_read(),dm_mdio_write()anddm_mdio_reset()for DM MDIO's .read(), .write() and .reset() operations.Signed-off-by Marek Behún <[email protected]>--- include/miiphy.h | 31 +++++++++++++++++++++++++++++++ net/mdio-uclass.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+)include/miiphy.h +31
-0@@ -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 * net/mdio-uclass.c +31
-1@@ -57,6 +57,37 @@ static int dm_mdio_post_bind(struct udevice *dev)return 0 ; } +int dm_mdio_read (struct udevice *mdio_dev,int addr,int devad,int reg) +{ +struct mdio_ops *ops =mdio_get_ops (mdio_dev); + +if (!ops->read) +return -ENOSYS ; + +return ops->read (mdio_dev, addr, devad, reg); +} + +int dm_mdio_write (struct udevice *mdio_dev,int addr,int devad,int reg, +u16 val) +{ +struct mdio_ops *ops =mdio_get_ops (mdio_dev); + +if (!ops->write) +return -ENOSYS ; + +return ops->write (mdio_dev, addr, devad, reg, val); +} + +int dm_mdio_reset (struct udevice *mdio_dev) +{ +struct mdio_ops *ops =mdio_get_ops (mdio_dev); + +if (!ops->reset) +return 0 ; + +return ops->reset (mdio_dev); +} +/* * Following read/write/reset functions are registered with legacy MII code. * These are called for PHY operations by upper layers and we further call the --
Quoted 2 lines
2.34.1
Re: [PATCH u-boot-net 03/14] net: introduce helpers to get PHY ofnode from MAC
In reply to Marek BehúnQuoted 192 lines · Marek Behún
From: Marek Behún <[email protected]>
Add helpers
ofnode_get_phy_node()anddev_get_phy_node()and use it innet/mdio-uclass.cfunctiondm_eth_connect_phy_handle().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 <[email protected]>--- drivers/core/ofnode.c | 21 +++++++++++++++++++++ drivers/core/read.c | 5 +++++ include/dm/ofnode.h | 14 ++++++++++++++ include/dm/read.h | 19 +++++++++++++++++++ net/mdio-uclass.c | 24 ++++++------------------ 5 files changed, 65 insertions(+), 18 deletions(-)drivers/core/ofnode.c +21
-0@@ -1162,3 +1162,24 @@ const char *ofnode_conf_read_str(const char *prop_name)return ofnode_read_string (node, prop_name); } + +ofnode ofnode_get_phy_node (ofnode node) +{ +/* DT node properties that reference a PHY node */ +static const char *const phy_handle_str[] = { +"phy-handle" ,"phy" ,"phy-device" , + }; +struct ofnode_phandle_args args = { + .node =ofnode_null () + }; +int i; + +assert (ofnode_valid (node)); + +for (i =0 ; i <ARRAY_SIZE (phy_handle_str); i++) +if (!ofnode_parse_phandle_with_args (node, phy_handle_str[i], +NULL ,0 ,0 , &args)) +break ; + +return args.node; +}drivers/core/read.c +5
-0@@ -398,3 +398,8 @@ int dev_decode_display_timing(const struct udevice *dev, int index, {return ofnode_decode_display_timing (dev_ofnode (dev), index, config); } + +ofnode dev_get_phy_node (const struct udevice *dev) +{ +return ofnode_get_phy_node (dev_ofnode (dev)); +}include/dm/ofnode.h +14
-0@@ -1204,4 +1204,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 include/dm/read.h +19
-0@@ -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 <asm/global_data.h> @@ -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 */ /** net/mdio-uclass.c +6
-19@@ -20,11 +20,6 @@ static const char * const phy_mode_str[] = { "phy-mode", "phy-connection-type" }; -/* DT node properties that reference a PHY node */ -static const char *const phy_handle_str[] = { -"phy-handle" ,"phy" ,"phy-device" -}; -void dm_mdio_probe_devices (void ) {struct udevice *it;@@ -137,23 +132,16 @@ static struct phy_device *dm_eth_connect_phy_handle(struct udevice *ethdev,u32 phy_addr;struct udevice *mdiodev;struct phy_device *phy; -struct ofnode_phandle_args phandle = {.node =ofnode_null ()};ofnode phynode; -int i;if (CONFIG_IS_ENABLED (PHY_FIXED ) &&ofnode_phy_is_fixed_link (dev_ofnode (ethdev), &phynode)) { phy =phy_connect (NULL ,0 , ethdev, interface); - phandle.node = phynode; goto out; } -for (i =0 ; i <ARRAY_SIZE (phy_handle_str); i++) -if (!dev_read_phandle_with_args (ethdev, phy_handle_str[i],NULL , -0 ,0 , &phandle)) -break ; - -if (!ofnode_valid (phandle.node)) { + phynode =dev_get_phy_node (ethdev); +if (!ofnode_valid (phynode)) {dev_dbg (ethdev,"can't find PHY node\n" );return NULL ; }@@ -162,16 +150,16 @@ static struct phy_device *dm_eth_connect_phy_handle(struct udevice *ethdev,* reading 'reg' directly should be fine. This is a PHY node, the * address is always size 1 and requires no translation */ -if (ofnode_read_u32 (phandle.node,"reg" , &phy_addr)) { +if (ofnode_read_u32 (phynode,"reg" , &phy_addr)) {dev_dbg (ethdev,"missing reg property in phy node\n" );return NULL ; }if (uclass_get_device_by_ofnode (UCLASS_MDIO , -ofnode_get_parent (phandle.node), +ofnode_get_parent (phynode), &mdiodev)) {dev_dbg (ethdev,"can't find MDIO bus for node %s\n" , -ofnode_get_name (ofnode_get_parent (phandle.node))); +ofnode_get_name (ofnode_get_parent (phynode)));return NULL ; }@@ -179,7 +167,7 @@ static struct phy_device *dm_eth_connect_phy_handle(struct udevice *ethdev, out:if (phy) - phy->node = phandle.node; + phy->node = phynode;return phy; } --
Quoted 2 lines
2.34.1
Re: [PATCH u-boot-net 05/14] treewide: use dm_mdio_read/write/reset() wrappers
In reply to Marek BehúnQuoted 223 lines · Marek Behún
From: Marek Behún <[email protected]>
Use the new dm_mdio_read/write/reset() wrappers treewide, instead of always getting and dereferencing MDIO operations structure pointer.
Signed-off-by Marek Behún <[email protected]>--- drivers/net/mdio_mux_sandbox.c | 6 ++---- net/mdio-mux-uclass.c | 16 ++++------------ net/mdio-uclass.c | 19 ++++--------------- test/dm/mdio.c | 18 +++++++++--------- test/dm/mdio_mux.c | 16 ++++++++-------- 5 files changed, 27 insertions(+), 48 deletions(-)drivers/net/mdio_mux_sandbox.c +2
-4@@ -20,7 +20,6 @@ struct mdio_mux_sandbox_priv {static int mdio_mux_sandbox_mark_selection (struct udevice *dev,int sel) {struct udevice *mdio; -struct mdio_ops *ops;int err;/* @@ -30,9 +29,8 @@ static int mdio_mux_sandbox_mark_selection(struct udevice *dev, int sel) err =uclass_get_device_by_name (UCLASS_MDIO ,"mdio-test" , &mdio);if (err)return err; - ops =mdio_get_ops (mdio); -return ops->write (mdio,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , -SANDBOX_PHY_REG_CNT -1 , (u16 )sel); +return dm_mdio_write (mdio,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , +SANDBOX_PHY_REG_CNT -1 , (u16 )sel); }static int mdio_mux_sandbox_select (struct udevice *dev,int cur,int sel)net/mdio-mux-uclass.c +4
-12@@ -54,11 +54,6 @@ static struct udevice *mmux_get_parent_mdio(struct udevice *mux)return pdata->mdio_parent; } -static struct mdio_ops *mmux_get_mdio_parent_ops (struct udevice *mux) -{ -return mdio_get_ops (mmux_get_parent_mdio (mux)); -} -/* call driver select function before performing MDIO r/w */ static int mmux_change_sel (struct udevice *ch,bool sel) {@@ -90,14 +85,13 @@ static int mmux_read(struct udevice *ch, int addr, int devad, {struct udevice *mux = ch->parent;struct udevice *parent_mdio =mmux_get_parent_mdio (mux); -struct mdio_ops *parent_ops =mmux_get_mdio_parent_ops (mux);int err; err =mmux_change_sel (ch, true);if (err)return err; - err = parent_ops->read (parent_mdio, addr, devad, reg); + err =dm_mdio_read (parent_mdio, addr, devad, reg);mmux_change_sel (ch, false);return err;@@ -109,14 +103,13 @@ static int mmux_write(struct udevice *ch, int addr, int devad, {struct udevice *mux = ch->parent;struct udevice *parent_mdio =mmux_get_parent_mdio (mux); -struct mdio_ops *parent_ops =mmux_get_mdio_parent_ops (mux);int err; err =mmux_change_sel (ch, true);if (err)return err; - err = parent_ops->write (parent_mdio, addr, devad, reg, val); + err =dm_mdio_write (parent_mdio, addr, devad, reg, val);mmux_change_sel (ch, false);return err;@@ -127,18 +120,17 @@ static int mmux_reset(struct udevice *ch) {struct udevice *mux = ch->parent;struct udevice *parent_mdio =mmux_get_parent_mdio (mux); -struct mdio_ops *parent_ops =mmux_get_mdio_parent_ops (mux);int err;/* reset is optional, if it's not implemented just exit */ -if (!parent_ops->reset) +if (!mdio_get_ops (parent_mdio)->reset)return 0 ; err =mmux_change_sel (ch, true);if (err)return err; - err = parent_ops->reset (parent_mdio); + err =dm_mdio_reset (parent_mdio);mmux_change_sel (ch, false);return err;net/mdio-uclass.c +4
-15@@ -95,27 +95,18 @@ int dm_mdio_reset(struct udevice *mdio_dev)*/ static int mdio_read (struct mii_dev *mii_bus,int addr,int devad,int reg) { -struct udevice *dev = mii_bus->priv; - -return mdio_get_ops (dev)->read (dev, addr, devad, reg); +return dm_mdio_read (mii_bus->priv, addr, devad, reg); }static int mdio_write (struct mii_dev *mii_bus,int addr,int devad,int reg,u16 val) { -struct udevice *dev = mii_bus->priv; - -return mdio_get_ops (dev)->write (dev, addr, devad, reg, val); +return dm_mdio_write (mii_bus->priv, addr, devad, reg, val); }static int mdio_reset (struct mii_dev *mii_bus) { -struct udevice *dev = mii_bus->priv; - -if (mdio_get_ops (dev)->reset) -return mdio_get_ops (dev)->reset (dev); -else -return 0 ; +return dm_mdio_reset (mii_bus->priv); }static int dm_mdio_post_probe (struct udevice *dev)@@ -135,10 +126,8 @@ static int dm_mdio_post_probe(struct udevice *dev)static int dm_mdio_pre_remove (struct udevice *dev) {struct mdio_perdev_priv *pdata =dev_get_uclass_priv (dev); -struct mdio_ops *ops =mdio_get_ops (dev); -if (ops->reset) - ops->reset (dev); +dm_mdio_reset (dev);mdio_unregister (pdata->mii_bus);mdio_free (pdata->mii_bus);test/dm/mdio.c +9
-9@@ -38,18 +38,18 @@ static int dm_test_mdio(struct unit_test_state *uts)ut_assertnonnull (ops->read);ut_assertnonnull (ops->write); -ut_assertok (ops->write (dev,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , -SANDBOX_PHY_REG ,TEST_REG_VALUE )); - reg = ops->read (dev,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , -SANDBOX_PHY_REG ); +ut_assertok (dm_mdio_write (dev,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , +SANDBOX_PHY_REG ,TEST_REG_VALUE )); + reg =dm_mdio_read (dev,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , +SANDBOX_PHY_REG );ut_asserteq (reg,TEST_REG_VALUE ); -ut_assert (ops->read (dev,SANDBOX_PHY_ADDR +1 ,MDIO_DEVAD_NONE , -SANDBOX_PHY_REG ) !=0 ); +ut_assert (dm_mdio_read (dev,SANDBOX_PHY_ADDR +1 ,MDIO_DEVAD_NONE , +SANDBOX_PHY_REG ) !=0 ); -ut_assertok (ops->reset (dev)); - reg = ops->read (dev,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , -SANDBOX_PHY_REG ); +ut_assertok (dm_mdio_reset (dev)); + reg =dm_mdio_read (dev,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , +SANDBOX_PHY_REG );ut_asserteq (reg,0 );return 0 ;test/dm/mdio_mux.c +8
-9@@ -57,22 +57,22 @@ static int dm_test_mdio_mux(struct unit_test_state *uts)* is selected to the selection #. Just reading that register from * either of the child buses should return the id of the child bus */ - reg = ops->read (mdio_ch0,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , -SANDBOX_PHY_REG_CNT -1 ); + reg =dm_mdio_read (mdio_ch0,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , +SANDBOX_PHY_REG_CNT -1 );ut_asserteq (reg,0 ); - reg = ops->read (mdio_ch1,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , -SANDBOX_PHY_REG_CNT -1 ); + reg =dm_mdio_read (mdio_ch1,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , +SANDBOX_PHY_REG_CNT -1 );ut_asserteq (reg,1 ); mmops->select (mux,MDIO_MUX_SELECT_NONE ,5 ); - reg = ops_parent->read (mdio,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , -SANDBOX_PHY_REG_CNT -1 ); + reg =dm_mdio_read (mdio,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , +SANDBOX_PHY_REG_CNT -1 );ut_asserteq (reg,5 ); mmops->deselect (mux,5 ); - reg = ops_parent->read (mdio,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , -SANDBOX_PHY_REG_CNT -1 ); + reg =dm_mdio_read (mdio,SANDBOX_PHY_ADDR ,MDIO_DEVAD_NONE , +SANDBOX_PHY_REG_CNT -1 );ut_asserteq (reg, (u16 )MDIO_MUX_SELECT_NONE );return 0 ; --
Quoted 2 lines
2.34.1
Re: [PATCH u-boot-net 06/14] net: phy: fix parsing wrong property
In reply to Marek BehúnQuoted 24 lines · Marek Behún
From: Marek Behún <[email protected]>
The "phy-interface-type" property should be "phy-connection-type".
Signed-off-by Marek Behún <[email protected]>--- drivers/net/phy/phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/phy/phy.c +1
-2@@ -989,7 +989,7 @@ struct phy_device *fixed_phy_create(ofnode node) if_str =ofnode_read_string (node,"phy-mode" );if (!if_str) { - if_str =ofnode_read_string (node,"phy-interface-type" ); + if_str =ofnode_read_string (node,"phy-connection-type" ); }if (if_str) { interface =phy_get_interface_by_name (if_str); --
Quoted 2 lines
2.34.1
Re: [PATCH u-boot-net 07/14] net: introduce helpers to get PHY interface mode from a device/ofnode
In reply to Marek BehúnQuoted 1,309 lines · Marek Behún
From: Marek Behún <[email protected]>
Add helpers
ofnode_read_phy_mode()anddev_read_phy_mode()to parse the "phy-mode" / "phy-connection-type" property.Use them treewide.
This allows us to inline the
phy_get_interface_by_name()intoofnode_read_phy_mode(), since the former is not used anymore.Signed-off-by Marek Behún <[email protected]>--- board/st/stm32f746-disco/stm32f746-disco.c | 13 +++----- drivers/core/ofnode.c | 23 ++++++++++++++ drivers/core/read.c | 5 +++ drivers/net/ag7xxx.c | 9 ++---- drivers/net/altera_tse.c | 13 ++------ drivers/net/bcm6348-eth.c | 6 +--- drivers/net/bcmgenet.c | 10 ++---- drivers/net/designware.c | 10 ++---- drivers/net/dwc_eth_qos.c | 36 +++------------------- drivers/net/fec_mxc.c | 11 ++----- drivers/net/fm/eth.c | 13 +------- drivers/net/fsl_enetc.c | 13 +++----- drivers/net/ftgmac100.c | 11 ++----- drivers/net/higmacv300.c | 9 ++---- drivers/net/ldpaa_eth/ldpaa_eth.c | 28 +++-------------- drivers/net/macb.c | 10 ++---- drivers/net/mt7620-eth.c | 35 +++++++-------------- drivers/net/mtk_eth.c | 8 ++--- drivers/net/mvgbe.c | 7 ++--- drivers/net/mvneta.c | 11 ++----- drivers/net/mvpp2.c | 9 ++---- drivers/net/phy/phy.c | 25 ++------------- drivers/net/pic32_eth.c | 11 ++----- drivers/net/qe/dm_qe_uec.c | 11 ++----- drivers/net/ravb.c | 15 +++------ drivers/net/sh_eth.c | 15 +++------ drivers/net/sni_ave.c | 12 ++------ drivers/net/sni_netsec.c | 10 ++---- drivers/net/sun8i_emac.c | 11 ++----- drivers/net/ti/am65-cpsw-nuss.c | 15 +++------ drivers/net/ti/cpsw.c | 10 ++---- drivers/net/ti/keystone_net.c | 24 +++++++-------- drivers/net/tsec.c | 9 ++---- drivers/net/xilinx_axi_emac.c | 10 ++---- drivers/net/zynq_gem.c | 9 ++---- include/dm/ofnode.h | 13 ++++++++ include/dm/read.h | 17 ++++++++++ include/phy.h | 8 ----- net/mdio-uclass.c | 18 +---------- 39 files changed, 161 insertions(+), 372 deletions(-)board/st/stm32f746-disco/stm32f746-disco.c +5
-8@@ -117,16 +117,13 @@ int board_late_init(void)int board_init (void ) {#ifdef CONFIG_ETH_DESIGNWARE -const char *phy_mode; -int node; +ofnode node; - node =fdt_node_offset_by_compatible (gd->fdt_blob,0 ,"st,stm32-dwmac" ); -if (node <0 ) + node =ofnode_by_compatible (ofnode_null (),"st,stm32-dwmac" ); +if (!ofnode_valid (node))return -1 ; - phy_mode =fdt_getprop (gd->fdt_blob, node,"phy-mode" ,NULL ); - -switch (phy_get_interface_by_name (phy_mode)) { +switch (ofnode_read_phy_mode (node)) {case PHY_INTERFACE_MODE_RMII :STM32_SYSCFG ->pmc |=SYSCFG_PMC_MII_RMII_SEL ;break ;@@ -134,7 +131,7 @@ int board_init(void)STM32_SYSCFG ->pmc &= ~SYSCFG_PMC_MII_RMII_SEL ;break ;default : - printf("PHY interface %s not supported !\n", phy_mode); + printf("Unsupported PHY interface!\n"); }#endif drivers/core/ofnode.c +23
-0@@ -1183,3 +1183,26 @@ ofnode ofnode_get_phy_node(ofnode node)return args.node; } + +phy_interface_t ofnode_read_phy_mode (ofnode node) +{ +const char *mode; +int i; + +assert (ofnode_valid (node)); + + mode =ofnode_read_string (node,"phy-mode" ); +if (!mode) + mode =ofnode_read_string (node,"phy-connection-type" ); + +if (!mode) +return PHY_INTERFACE_MODE_NONE ; + +for (i =0 ; i <PHY_INTERFACE_MODE_COUNT ; i++) +if (!strcmp (mode, phy_interface_strings[i])) +return i; + +debug ("%s: Invalid PHY interface '%s'\n" , __func__, mode); + +return PHY_INTERFACE_MODE_NONE ; +}drivers/core/read.c +5
-0@@ -403,3 +403,8 @@ ofnode dev_get_phy_node(const struct udevice *dev) {return ofnode_get_phy_node (dev_ofnode (dev)); } + +phy_interface_t dev_read_phy_mode (const struct udevice *dev) +{ +return ofnode_read_phy_mode (dev_ofnode (dev)); +}drivers/net/ag7xxx.c +2
-7@@ -1254,7 +1254,6 @@ static const struct eth_ops ag7xxx_eth_ops = {static int ag7xxx_eth_of_to_plat (struct udevice *dev) {struct eth_pdata *pdata =dev_get_plat (dev); -const char *phy_mode;int ret; pdata->iobase =dev_read_addr (dev);@@ -1265,13 +1264,9 @@ static int ag7xxx_eth_of_to_plat(struct udevice *dev)if (ret <=0 )return ret; - phy_mode =fdt_getprop (gd->fdt_blob, ret,"phy-mode" ,NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }return 0 ; }drivers/net/altera_tse.c +3
-10@@ -676,17 +676,10 @@ static int altera_tse_probe(struct udevice *dev)static int altera_tse_of_to_plat (struct udevice *dev) {struct eth_pdata *pdata =dev_get_plat (dev); -const char *phy_mode; - - pdata->phy_interface =-1 ; - phy_mode =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"phy-mode" , -NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }return 0 ; }drivers/net/bcm6348-eth.c +1
-5@@ -415,7 +415,6 @@ static int bcm6348_eth_probe(struct udevice *dev)struct eth_pdata *pdata =dev_get_plat (dev);struct bcm6348_eth_priv *priv =dev_get_priv (dev);struct ofnode_phandle_args phy; -const char *phy_mode;int ret, i;/* get base address */ @@ -425,10 +424,7 @@ static int bcm6348_eth_probe(struct udevice *dev) pdata->iobase = (phys_addr_t ) priv->base;/* get phy mode */ - pdata->phy_interface =PHY_INTERFACE_MODE_NONE ; - phy_mode =dev_read_string (dev,"phy-mode" ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev);if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -ENODEV ;drivers/net/bcmgenet.c +2
-8@@ -690,20 +690,14 @@ static int bcmgenet_eth_of_to_plat(struct udevice *dev)struct eth_pdata *pdata =dev_get_plat (dev);struct bcmgenet_eth_priv *priv =dev_get_priv (dev);struct ofnode_phandle_args phy_node; -const char *phy_mode;int ret; pdata->iobase =dev_read_addr (dev);/* Get phy mode from DT */ - pdata->phy_interface =-1 ; - phy_mode =dev_read_string (dev,"phy-mode" ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - } ret =dev_read_phandle_with_args (dev,"phy-handle" ,NULL ,0 ,0 , &phy_node);drivers/net/designware.c +2
-8@@ -914,21 +914,15 @@ int designware_eth_of_to_plat(struct udevice *dev)struct dw_eth_dev *priv =dev_get_priv (dev);#endif struct eth_pdata *pdata = &dw_pdata->eth_pdata; -const char *phy_mode;#if CONFIG_IS_ENABLED (DM_GPIO )int reset_flags =GPIOD_IS_OUT ;#endif int ret =0 ; pdata->iobase =dev_read_addr (dev); - pdata->phy_interface =-1 ; - phy_mode =dev_read_string (dev,"phy-mode" ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - } pdata->max_speed =dev_read_u32_default (dev,"max-speed" ,0 );drivers/net/dwc_eth_qos.c +4
-32@@ -270,7 +270,7 @@ struct eqos_config {int config_mac;int config_mac_mdio;unsigned int axi_bus_width; -phy_interface_t (*interface)(struct udevice *dev); +phy_interface_t (*interface)(const struct udevice *dev);struct eqos_ops *ops; };@@ -1729,21 +1729,7 @@ err_probe:return ret; } -static phy_interface_t eqos_get_interface_stm32 (struct udevice *dev) -{ -const char *phy_mode; -phy_interface_t interface =PHY_INTERFACE_MODE_NONE ; - -debug ("%s(dev=%p):\n" , __func__, dev); - - phy_mode =dev_read_prop (dev,"phy-mode" ,NULL ); -if (phy_mode) - interface =phy_get_interface_by_name (phy_mode); - -return interface; -} - -static phy_interface_t eqos_get_interface_tegra186 (struct udevice *dev) +static phy_interface_t eqos_get_interface_tegra186 (const struct udevice *dev) {return PHY_INTERFACE_MODE_MII ; }@@ -1766,20 +1752,6 @@ static int eqos_probe_resources_imx(struct udevice *dev)return 0 ; } -static phy_interface_t eqos_get_interface_imx (struct udevice *dev) -{ -const char *phy_mode; -phy_interface_t interface =PHY_INTERFACE_MODE_NONE ; - -debug ("%s(dev=%p):\n" , __func__, dev); - - phy_mode =dev_read_prop (dev,"phy-mode" ,NULL ); -if (phy_mode) - interface =phy_get_interface_by_name (phy_mode); - -return interface; -} -static int eqos_remove_resources_tegra186 (struct udevice *dev) {struct eqos_priv *eqos =dev_get_priv (dev);@@ -1985,7 +1957,7 @@ static const struct eqos_config __maybe_unused eqos_stm32_config = { .config_mac = EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_AV, .config_mac_mdio = EQOS_MAC_MDIO_ADDRESS_CR_250_300, .axi_bus_width = EQOS_AXI_WIDTH_64, - .interface = eqos_get_interface_stm32, + .interface = dev_read_phy_mode, .ops = &eqos_stm32_ops };@@ -2013,7 +1985,7 @@ struct eqos_config __maybe_unused eqos_imx_config = { .config_mac = EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_DCB, .config_mac_mdio = EQOS_MAC_MDIO_ADDRESS_CR_250_300, .axi_bus_width = EQOS_AXI_WIDTH_64, - .interface = eqos_get_interface_imx, + .interface = dev_read_phy_mode, .ops = &eqos_imx_ops };drivers/net/fec_mxc.c +2
-9@@ -1558,20 +1558,13 @@ static int fecmxc_of_to_plat(struct udevice *dev)int ret =0 ;struct eth_pdata *pdata =dev_get_plat (dev);struct fec_priv *priv =dev_get_priv (dev); -const char *phy_mode; pdata->iobase =dev_read_addr (dev); priv->eth = (struct ethernet_regs *)pdata->iobase; - pdata->phy_interface =-1 ; - phy_mode =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"phy-mode" , -NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }#ifdef CONFIG_DM_REGULATOR device_get_supply_regulator (dev,"phy-supply" , &priv->phy_supply);drivers/net/fm/eth.c +1
-12@@ -954,17 +954,6 @@ int fm_eth_initialize(struct ccsr_fman *reg, struct fm_eth_info *info) return 0; }#else /* CONFIG_DM_ETH */ -#ifdef CONFIG_PHYLIB -phy_interface_t fman_read_sys_if (struct udevice *dev) -{ -const char *if_str; - - if_str =ofnode_read_string (dev_ofnode (dev),"phy-connection-type" ); -debug ("MAC system interface mode %s\n" , if_str); - -return phy_get_interface_by_name (if_str); -} -#endif static int fm_eth_bind (struct udevice *dev) {@@ -1038,7 +1027,7 @@ static int fm_eth_probe(struct udevice *dev) reg = (void *)(uintptr_t )dev_read_addr (dev); fm_eth->mac_type =dev_get_driver_data (dev);#ifdef CONFIG_PHYLIB - fm_eth->enet_if =fman_read_sys_if (dev); + fm_eth->enet_if =dev_read_phy_mode (dev);#else fm_eth->enet_if =PHY_INTERFACE_MODE_SGMII ;printf ("%s: warning - unable to determine interface type\n" , __func__);drivers/net/fsl_enetc.c +4
-9@@ -260,9 +260,6 @@ static int enetc_init_sxgmii(struct udevice *dev)static void enetc_start_pcs (struct udevice *dev) {struct enetc_priv *priv =dev_get_priv (dev); -const char *if_str; - - priv->if_type =PHY_INTERFACE_MODE_NONE ;/* register internal MDIO for debug purposes */ if (enetc_read_port (priv,ENETC_PCAPR0 ) &ENETC_PCAPRO_MDIO ) {@@ -279,14 +276,12 @@ static void enetc_start_pcs(struct udevice *dev)return ; } - if_str =ofnode_read_string (dev_ofnode (dev),"phy-mode" ); -if (if_str) - priv->if_type =phy_get_interface_by_name (if_str); -else + priv->if_type =dev_read_phy_mode (dev); +if (priv->if_type ==PHY_INTERFACE_MODE_NONE ) {enetc_dbg (dev,"phy-mode property not found, defaulting to SGMII\n" ); -if (priv->if_type <0 ) - priv->if_type =PHY_INTERFACE_MODE_NONE ; + priv->if_type =PHY_INTERFACE_MODE_SGMII ; + }switch (priv->if_type) {case PHY_INTERFACE_MODE_SGMII :drivers/net/ftgmac100.c +3
-8@@ -549,17 +549,12 @@ static int ftgmac100_of_to_plat(struct udevice *dev) {struct eth_pdata *pdata =dev_get_plat (dev);struct ftgmac100_data *priv =dev_get_priv (dev); -const char *phy_mode; pdata->iobase =dev_read_addr (dev); - pdata->phy_interface =-1 ; - phy_mode =dev_read_string (dev,"phy-mode" ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -dev_err (dev,"Invalid PHY interface '%s'\n" , phy_mode); + + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - } pdata->max_speed =dev_read_u32_default (dev,"max-speed" ,0 );drivers/net/higmacv300.c +2
-7@@ -561,19 +561,14 @@ static int higmac_remove(struct udevice *dev)static int higmac_of_to_plat (struct udevice *dev) {struct higmac_priv *priv =dev_get_priv (dev); -int phyintf =PHY_INTERFACE_MODE_NONE ; -const char *phy_mode;ofnode phy_node; priv->base =dev_remap_addr_index (dev,0 ); priv->macif_ctrl =dev_remap_addr_index (dev,1 ); - phy_mode =dev_read_string (dev,"phy-mode" ); -if (phy_mode) - phyintf =phy_get_interface_by_name (phy_mode); -if (phyintf ==PHY_INTERFACE_MODE_NONE ) + priv->phyintf =dev_read_phy_mode (dev); +if (priv->phyintf ==PHY_INTERFACE_MODE_NONE )return -ENODEV ; - priv->phyintf = phyintf; phy_node =dev_read_subnode (dev,"phy" );if (!ofnode_valid (phy_node)) {drivers/net/ldpaa_eth/ldpaa_eth.c +5
-23@@ -1120,31 +1120,14 @@ static uint32_t ldpaa_eth_get_dpmac_id(struct udevice *dev)return fdtdec_get_uint (gd->fdt_blob, port_node,"reg" ,-1 ); } -static const char *ldpaa_eth_get_phy_mode_str (struct udevice *dev) -{ -int port_node =dev_of_offset (dev); -const char *phy_mode_str; - - phy_mode_str =fdt_getprop (gd->fdt_blob, port_node, -"phy-connection-type" ,NULL ); -if (phy_mode_str) -return phy_mode_str; - - phy_mode_str =fdt_getprop (gd->fdt_blob, port_node,"phy-mode" ,NULL ); -return phy_mode_str; -} -static int ldpaa_eth_bind (struct udevice *dev) { -const char *phy_mode_str =NULL ;uint32_t dpmac_id;char eth_name[16 ];int phy_mode =-1 ; - phy_mode_str =ldpaa_eth_get_phy_mode_str (dev); -if (phy_mode_str) - phy_mode =phy_get_interface_by_name (phy_mode_str); -if (phy_mode ==-1 ) { + phy_mode =dev_read_phy_mode (dev); +if (phy_mode ==PHY_INTERFACE_MODE_NONE ) {dev_err (dev,"incorrect phy mode\n" );return -EINVAL ; }@@ -1155,7 +1138,8 @@ static int ldpaa_eth_bind(struct udevice *dev)return -EINVAL ; } -sprintf (eth_name,"DPMAC%d@%s" , dpmac_id, phy_mode_str); +sprintf (eth_name,"DPMAC%d@%s" , dpmac_id, +phy_string_for_interface (phy_mode));device_set_name (dev, eth_name);return 0 ;@@ -1164,11 +1148,9 @@ static int ldpaa_eth_bind(struct udevice *dev)static int ldpaa_eth_of_to_plat (struct udevice *dev) {struct ldpaa_eth_priv *priv =dev_get_priv (dev); -const char *phy_mode_str; priv->dpmac_id =ldpaa_eth_get_dpmac_id (dev); - phy_mode_str =ldpaa_eth_get_phy_mode_str (dev); - priv->phy_mode =phy_get_interface_by_name (phy_mode_str); + priv->phy_mode =dev_read_phy_mode (dev);return 0 ; }drivers/net/macb.c +2
-8@@ -1360,17 +1360,11 @@ static int macb_eth_probe(struct udevice *dev)struct eth_pdata *pdata =dev_get_plat (dev);struct macb_device *macb =dev_get_priv (dev);struct ofnode_phandle_args phandle_args; -const char *phy_mode;int ret; - phy_mode =dev_read_prop (dev,"phy-mode" ,NULL ); - -if (phy_mode) - macb->phy_interface =phy_get_interface_by_name (phy_mode); -if (macb->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + macb->phy_interface =dev_read_phy_mode (dev); +if (macb->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }/* Read phyaddr from DT */ if (!dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,drivers/net/mt7620-eth.c +11
-24@@ -1048,33 +1048,20 @@ static int mt7620_eth_parse_gsw_port(struct mt7620_eth_priv *priv, u32 idx, ofnode node) {ofnode subnode; -const char *str; -int mode, speed, ret; +int speed, ret;u32 phy_addr; - str =ofnode_read_string (node,"phy-mode" ); -if (str) { - mode =phy_get_interface_by_name (str); -if (mode <0 ) { -dev_err (priv->dev,"mt7620_eth: invalid phy-mode\n" ); -return -EINVAL ; - } - -switch (mode) { -case PHY_INTERFACE_MODE_MII : -case PHY_INTERFACE_MODE_RMII : -case PHY_INTERFACE_MODE_RGMII : -case PHY_INTERFACE_MODE_NONE : -break ; -default : -dev_err (priv->dev, -"mt7620_eth: unsupported phy-mode\n" ); -return -ENOTSUPP ; - } + priv->port_cfg[idx].mode =ofnode_read_phy_mode (node); - priv->port_cfg[idx].mode = mode; - }else { - priv->port_cfg[idx].mode =PHY_INTERFACE_MODE_NONE ; +switch (priv->port_cfg[idx].mode) { +case PHY_INTERFACE_MODE_MII : +case PHY_INTERFACE_MODE_RMII : +case PHY_INTERFACE_MODE_RGMII : +case PHY_INTERFACE_MODE_NONE : +break ; +default : +dev_err (priv->dev,"mt7620_eth: unsupported phy-mode\n" ); +return -ENOTSUPP ; } subnode =ofnode_find_subnode (node,"fixed-link" );drivers/net/mtk_eth.c +3
-5@@ -1447,11 +1447,9 @@ static int mtk_eth_of_to_plat(struct udevice *dev) priv->gmac_id =dev_read_u32_default (dev,"mediatek,gmac-id" ,0 );/* Interface mode is required */ - str =dev_read_string (dev,"phy-mode" ); -if (str) { - pdata->phy_interface =phy_get_interface_by_name (str); - priv->phy_interface = pdata->phy_interface; - }else { + pdata->phy_interface =dev_read_phy_mode (dev); + priv->phy_interface = pdata->phy_interface; +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) {printf ("error: phy-mode is not set\n" );return -EINVAL ; }drivers/net/mvgbe.c +2
-5@@ -993,7 +993,6 @@ static int mvgbe_of_to_plat(struct udevice *dev)struct mvgbe_device *dmvgbe =dev_get_priv (dev);void *blob = (void *)gd->fdt_blob;int node =dev_of_offset (dev); -const char *phy_mode;int fl_node;int pnode;unsigned long addr;@@ -1005,10 +1004,8 @@ static int mvgbe_of_to_plat(struct udevice *dev) "marvell,kirkwood-eth-port");/* Get phy-mode / phy_interface from DT */ - phy_mode =fdt_getprop (gd->fdt_blob, pnode,"phy-mode" ,NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -else + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) pdata->phy_interface =PHY_INTERFACE_MODE_GMII ; dmvgbe->phy_interface = pdata->phy_interface;drivers/net/mvneta.c +2
-9@@ -1799,20 +1799,13 @@ static const struct eth_ops mvneta_ops = {static int mvneta_of_to_plat (struct udevice *dev) {struct eth_pdata *pdata =dev_get_plat (dev); -const char *phy_mode; pdata->iobase =dev_read_addr (dev);/* Get phy-mode / phy_interface from DT */ - pdata->phy_interface =-1 ; - phy_mode =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"phy-mode" , -NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }return 0 ; }drivers/net/mvpp2.c +2
-7@@ -4786,11 +4786,9 @@ static int mvpp2_port_init(struct udevice *dev, struct mvpp2_port *port)static int phy_info_parse (struct udevice *dev,struct mvpp2_port *port) {int port_node =dev_of_offset (dev); -const char *phy_mode_str;int phy_node;u32 id;u32 phyaddr =0 ; -int phy_mode =-1 ;int fixed_link =0 ;int ret;@@ -4821,10 +4819,8 @@ static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port) phyaddr =PHY_MAX_ADDR ; } - phy_mode_str =fdt_getprop (gd->fdt_blob, port_node,"phy-mode" ,NULL ); -if (phy_mode_str) - phy_mode =phy_get_interface_by_name (phy_mode_str); -if (phy_mode ==-1 ) { + port->phy_interface =dev_read_phy_mode (dev); +if (port->phy_interface ==PHY_INTERFACE_MODE_NONE ) {dev_err (dev,"incorrect phy mode\n" );return -EINVAL ; }@@ -4847,7 +4843,6 @@ static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port) port->first_rxq = port->id * rxq_number; else port->first_rxq = port->id * port->priv->max_port_rxqs; - port->phy_interface = phy_mode; port->phyaddr = phyaddr;return 0 ;drivers/net/phy/phy.c +2
-23@@ -982,25 +982,16 @@ static struct phy_device *phy_connect_gmii2rgmii(struct mii_dev *bus,*/ struct phy_device *fixed_phy_create (ofnode node) { -phy_interface_t interface =PHY_INTERFACE_MODE_NONE ;struct phy_device *phydev; -const char *if_str;ofnode subnode; - if_str =ofnode_read_string (node,"phy-mode" ); -if (!if_str) { - if_str =ofnode_read_string (node,"phy-connection-type" ); - } -if (if_str) { - interface =phy_get_interface_by_name (if_str); - } - subnode =ofnode_find_subnode (node,"fixed-link" );if (!ofnode_valid (subnode)) {return NULL ; } - phydev =phy_device_create (NULL ,0 ,PHY_FIXED_ID , false, interface); + phydev =phy_device_create (NULL ,0 ,PHY_FIXED_ID , false, +ofnode_read_phy_mode (node));if (phydev) phydev->node = subnode;@@ -1093,15 +1084,3 @@ int phy_shutdown(struct phy_device *phydev)return 0 ; } - -int phy_get_interface_by_name (const char *str) -{ -int i; - -for (i =0 ; i <PHY_INTERFACE_MODE_COUNT ; i++) { -if (!strcmp (str, phy_interface_strings[i])) -return i; - } - -return -1 ; -}drivers/net/pic32_eth.c +2
-9@@ -534,7 +534,6 @@ static int pic32_eth_probe(struct udevice *dev) {struct eth_pdata *pdata =dev_get_plat (dev);struct pic32eth_dev *priv =dev_get_priv (dev); -const char *phy_mode;void __iomem *iobase;fdt_addr_t addr;fdt_size_t size;@@ -550,15 +549,9 @@ static int pic32_eth_probe(struct udevice *dev) pdata->iobase = (phys_addr_t )addr;/* get phy mode */ - pdata->phy_interface =-1 ; - phy_mode =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"phy-mode" , -NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }/* get phy addr */ offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev),drivers/net/qe/dm_qe_uec.c +2
-9@@ -1133,19 +1133,12 @@ static int qe_uec_remove(struct udevice *dev)static int qe_uec_of_to_plat (struct udevice *dev) {struct eth_pdata *pdata =dev_get_plat (dev); -const char *phy_mode; pdata->iobase = (phys_addr_t )devfdt_get_addr (dev); - pdata->phy_interface =-1 ; - phy_mode =fdt_getprop (gd->fdt_blob,dev_of_offset (dev), -"phy-connection-type" ,NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }return 0 ; }drivers/net/ravb.c +4
-11@@ -674,20 +674,13 @@ static const struct eth_ops ravb_ops = {int ravb_of_to_plat (struct udevice *dev) {struct eth_pdata *pdata =dev_get_plat (dev); -const char *phy_mode;const fdt32_t *cell; -int ret =0 ; pdata->iobase =dev_read_addr (dev); - pdata->phy_interface =-1 ; - phy_mode =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"phy-mode" , -NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - } pdata->max_speed =1000 ; cell =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"max-speed" ,NULL );@@ -696,7 +689,7 @@ int ravb_of_to_plat(struct udevice *dev)sprintf (bb_miiphy_buses[0 ].name, dev->name); -return ret; +return 0 ; }static const struct udevice_id ravb_ids[] = {drivers/net/sh_eth.c +4
-11@@ -915,20 +915,13 @@ static const struct eth_ops sh_ether_ops = {int sh_ether_of_to_plat (struct udevice *dev) {struct eth_pdata *pdata =dev_get_plat (dev); -const char *phy_mode;const fdt32_t *cell; -int ret =0 ; pdata->iobase =dev_read_addr (dev); - pdata->phy_interface =-1 ; - phy_mode =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"phy-mode" , -NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - } pdata->max_speed =1000 ; cell =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"max-speed" ,NULL );@@ -937,7 +930,7 @@ int sh_ether_of_to_plat(struct udevice *dev)sprintf (bb_miiphy_buses[0 ].name, dev->name); -return ret; +return 0 ; }static const struct udevice_id sh_ether_ids[] = {drivers/net/sni_ave.c +3
-9@@ -738,7 +738,6 @@ static int ave_of_to_plat(struct udevice *dev)struct eth_pdata *pdata =dev_get_plat (dev);struct ave_private *priv =dev_get_priv (dev);struct ofnode_phandle_args args; -const char *phy_mode;const u32 *valp;int ret, nc, nr;const char *name;@@ -748,15 +747,10 @@ static int ave_of_to_plat(struct udevice *dev)return -EINVAL ; pdata->iobase =dev_read_addr (dev); - pdata->phy_interface =-1 ; - phy_mode =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"phy-mode" , -NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -dev_err (dev,"Invalid PHY interface '%s'\n" , phy_mode); + + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - } pdata->max_speed =0 ; valp = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "max-speed",drivers/net/sni_netsec.c +2
-8@@ -1029,19 +1029,13 @@ static int netsec_of_to_plat(struct udevice *dev)struct eth_pdata *pdata =dev_get_plat (dev);struct netsec_priv *priv =dev_get_priv (dev);struct ofnode_phandle_args phandle_args; -const char *phy_mode; pdata->iobase =dev_read_addr_index (dev,0 ); priv->eeprom_base =dev_read_addr_index (dev,1 ) -EERPROM_MAP_OFFSET ; - pdata->phy_interface =-1 ; - phy_mode =dev_read_prop (dev,"phy-mode" ,NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -pr_err ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }if (!dev_read_phandle_with_args (dev,"phy-handle" ,NULL ,0 ,0 , &phandle_args))drivers/net/sun8i_emac.c +2
-9@@ -882,7 +882,6 @@ static int sun8i_emac_eth_of_to_plat(struct udevice *dev)struct sun8i_eth_pdata *sun8i_pdata =dev_get_plat (dev);struct eth_pdata *pdata = &sun8i_pdata->eth_pdata;struct emac_eth_dev *priv =dev_get_priv (dev); -const char *phy_mode;const fdt32_t *reg;int node =dev_of_offset (dev);int offset =0 ;@@ -946,16 +945,10 @@ static int sun8i_emac_eth_of_to_plat(struct udevice *dev) } priv->phyaddr =fdtdec_get_int (gd->fdt_blob, offset,"reg" ,-1 ); - phy_mode =fdt_getprop (gd->fdt_blob, node,"phy-mode" ,NULL ); - -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev);printf ("phy interface%d\n" , pdata->phy_interface); - -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }if (priv->variant ==H3_EMAC ) { ret =sun8i_handle_internal_phy (dev, priv);drivers/net/ti/am65-cpsw-nuss.c +4
-11@@ -602,21 +602,14 @@ static int am65_cpsw_ofdata_parse_phy(struct udevice *dev)struct eth_pdata *pdata =dev_get_plat (dev);struct am65_cpsw_priv *priv =dev_get_priv (dev);struct ofnode_phandle_args out_args; -const char *phy_mode;int ret =0 ;dev_read_u32 (dev,"reg" , &priv->port_id); - phy_mode =dev_read_string (dev,"phy-mode" ); -if (phy_mode) { - pdata->phy_interface = -phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -dev_err (dev,"Invalid PHY mode '%s', port %u\n" , - phy_mode, priv->port_id); - ret = -EINVAL ; - goto out; - } + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) { +dev_err (dev,"Invalid PHY mode, port %u\n" , priv->port_id); +return -EINVAL ; }dev_read_u32 (dev,"max-speed" , (u32 *)&pdata->max_speed);drivers/net/ti/cpsw.c +2
-8@@ -1194,15 +1194,12 @@ static void cpsw_eth_of_parse_slave(struct cpsw_platform_data *data, {struct ofnode_phandle_args out_args;struct cpsw_slave_data *slave_data; -const char *phy_mode;u32 phy_id[2 ];int ret; slave_data = &data->slave_data[slave_index]; - phy_mode =ofnode_read_string (subnode,"phy-mode" ); -if (phy_mode) - slave_data->phy_if =phy_get_interface_by_name (phy_mode); + slave_data->phy_if =ofnode_read_phy_mode (subnode); ret =ofnode_parse_phandle_with_args (subnode,"phy-handle" ,NULL ,0 ,0 , &out_args);@@ -1348,11 +1345,8 @@ static int cpsw_eth_of_to_plat(struct udevice *dev) } pdata->phy_interface = data->slave_data[data->active_slave].phy_if; -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, -phy_string_for_interface (pdata->phy_interface)); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - }return 0 ; }drivers/net/ti/keystone_net.c +11
-13@@ -687,7 +687,6 @@ static int ks2_eth_parse_slave_interface(int netcp, int slave,int phy;int dma_count;u32 dma_channel[8 ]; -const char *phy_mode; priv->slave_port =fdtdec_get_int (fdt, slave,"slave-port" ,-1 ); priv->net_rx_buffs.rx_flow = priv->slave_port *8 ;@@ -728,20 +727,19 @@ static int ks2_eth_parse_slave_interface(int netcp, int slave, priv->sgmii_link_type =SGMII_LINK_MAC_PHY ; priv->has_mdio = true; }else if (priv->link_type ==LINK_TYPE_RGMII_LINK_MAC_PHY ) { - phy_mode =fdt_getprop (fdt, slave,"phy-mode" ,NULL ); -if (phy_mode) { - priv->phy_if =phy_get_interface_by_name (phy_mode); -if (priv->phy_if !=PHY_INTERFACE_MODE_RGMII && - priv->phy_if !=PHY_INTERFACE_MODE_RGMII_ID && - priv->phy_if !=PHY_INTERFACE_MODE_RGMII_RXID && - priv->phy_if !=PHY_INTERFACE_MODE_RGMII_TXID ) { -pr_err ("invalid phy-mode\n" ); -return -EINVAL ; - } - }else { + priv->phy_if =ofnode_read_phy_mode (offset_to_ofnode (slave)); +if (priv->phy_if ==PHY_INTERFACE_MODE_NONE ) priv->phy_if =PHY_INTERFACE_MODE_RGMII ; - } pdata->phy_interface = priv->phy_if; + +if (priv->phy_if !=PHY_INTERFACE_MODE_RGMII && + priv->phy_if !=PHY_INTERFACE_MODE_RGMII_ID && + priv->phy_if !=PHY_INTERFACE_MODE_RGMII_RXID && + priv->phy_if !=PHY_INTERFACE_MODE_RGMII_TXID ) { +pr_err ("invalid phy-mode\n" ); +return -EINVAL ; + } + priv->has_mdio = true; }drivers/net/tsec.c +2
-7@@ -834,7 +834,6 @@ int tsec_probe(struct udevice *dev)struct ofnode_phandle_args phandle_args;u32 tbiaddr =CONFIG_SYS_TBIPA_VALUE ;struct tsec_data *data; -const char *phy_mode;ofnode parent, child;fdt_addr_t reg;u32 max_speed;@@ -894,12 +893,8 @@ int tsec_probe(struct udevice *dev) priv->tbiaddr = tbiaddr; - phy_mode =dev_read_prop (dev,"phy-connection-type" ,NULL ); -if (!phy_mode) - phy_mode =dev_read_prop (dev,"phy-mode" ,NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) pdata->phy_interface =tsec_get_interface (priv); priv->interface = pdata->phy_interface;drivers/net/xilinx_axi_emac.c +2
-8@@ -821,7 +821,6 @@ static int axi_emac_of_to_plat(struct udevice *dev)struct eth_pdata *pdata = &plat->eth_pdata;int node =dev_of_offset (dev);int offset =0 ; -const char *phy_mode; pdata->iobase =dev_read_addr (dev); plat->mactype =dev_get_driver_data (dev);@@ -850,14 +849,9 @@ static int axi_emac_of_to_plat(struct udevice *dev) plat->phy_of_handle = offset; } - phy_mode =fdt_getprop (gd->fdt_blob, node,"phy-mode" ,NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -printf ("%s: Invalid PHY interface '%s'\n" , __func__, - phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - } plat->eth_hasnobuf =fdtdec_get_bool (gd->fdt_blob, node,"xlnx,eth-hasnobuf" );drivers/net/zynq_gem.c +2
-7@@ -827,7 +827,6 @@ static int zynq_gem_of_to_plat(struct udevice *dev)struct eth_pdata *pdata =dev_get_plat (dev);struct zynq_gem_priv *priv =dev_get_priv (dev);struct ofnode_phandle_args phandle_args; -const char *phy_mode; pdata->iobase = (phys_addr_t )dev_read_addr (dev); priv->iobase = (struct zynq_gem_regs *)pdata->iobase;@@ -859,13 +858,9 @@ static int zynq_gem_of_to_plat(struct udevice *dev) } } - phy_mode =dev_read_prop (dev,"phy-mode" ,NULL ); -if (phy_mode) - pdata->phy_interface =phy_get_interface_by_name (phy_mode); -if (pdata->phy_interface ==-1 ) { -debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode); + pdata->phy_interface =dev_read_phy_mode (dev); +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE )return -EINVAL ; - } priv->interface = pdata->phy_interface; priv->int_pcs =dev_read_bool (dev,"is-internal-pcspma" );include/dm/ofnode.h +13
-0@@ -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@@ -1218,4 +1219,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 include/dm/read.h +17
-0@@ -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 <asm/global_data.h> @@ -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 */ /** include/phy.h +0
-8@@ -542,14 +542,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) net/mdio-uclass.c +1
-18@@ -15,11 +15,6 @@#include <dm/uclass-internal.h> #include <linux/compat.h> -/* DT node properties for MAC-PHY interface */ -static const char *const phy_mode_str[] = { -"phy-mode" ,"phy-connection-type" -}; -void dm_mdio_probe_devices (void ) {struct udevice *it;@@ -195,26 +190,15 @@ out:/* Connect to a PHY linked in eth DT node */ struct phy_device *dm_eth_phy_connect (struct udevice *ethdev) { -const char *if_str;phy_interface_t interface;struct phy_device *phy; -int i;if (!dev_has_ofnode (ethdev)) {debug ("%s: supplied eth dev has no DT node!\n" , ethdev->name);return NULL ; } - interface =PHY_INTERFACE_MODE_NONE ; -for (i =0 ; i <ARRAY_SIZE (phy_mode_str); i++) { - if_str =dev_read_string (ethdev, phy_mode_str[i]); -if (if_str) { - interface =phy_get_interface_by_name (if_str); -break ; - } - } -if (interface <0 ) - interface =PHY_INTERFACE_MODE_NONE ; + interface =dev_read_phy_mode (ethdev);if (interface ==PHY_INTERFACE_MODE_NONE )dev_dbg (ethdev,"can't find interface mode, default to NONE\n" ); --
Quoted 2 lines
2.34.1
Re: [PATCH u-boot-net 09/14] treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA
In reply to Marek BehúnQuoted 1,173 lines · Marek Behún
From: Marek Behún <[email protected]>
Rename constant
PHY_INTERFACE_MODE_NONEtoPHY_INTERFACE_MODE_NAto make it compatible with Linux' naming.Signed-off-by Marek Behún <[email protected]>--- board/freescale/corenet_ds/eth_hydra.c | 2 +- board/freescale/corenet_ds/eth_superhydra.c | 4 ++-- board/freescale/t104xrdb/eth.c | 4 ++-- drivers/core/ofnode.c | 4 ++-- drivers/net/ag7xxx.c | 2 +- drivers/net/altera_tse.c | 2 +- drivers/net/bcm6348-eth.c | 2 +- drivers/net/bcmgenet.c | 2 +- drivers/net/designware.c | 2 +- drivers/net/dwc_eth_qos.c | 4 ++-- drivers/net/fec_mxc.c | 2 +- drivers/net/fm/b4860.c | 8 ++++---- drivers/net/fm/init.c | 8 ++++---- drivers/net/fm/ls1043.c | 6 +++--- drivers/net/fm/ls1046.c | 8 ++++---- drivers/net/fm/p1023.c | 4 ++-- drivers/net/fm/p4080.c | 6 +++--- drivers/net/fm/p5020.c | 6 +++--- drivers/net/fm/p5040.c | 6 +++--- drivers/net/fm/t1024.c | 4 ++-- drivers/net/fm/t1040.c | 4 ++-- drivers/net/fm/t2080.c | 6 +++--- drivers/net/fm/t4240.c | 6 +++--- drivers/net/fsl_enetc.c | 2 +- drivers/net/ftgmac100.c | 2 +- drivers/net/higmacv300.c | 2 +- drivers/net/ldpaa_eth/ldpaa_eth.c | 2 +- drivers/net/ldpaa_eth/ldpaa_wriop.c | 10 +++++----- drivers/net/ldpaa_eth/ls1088a.c | 4 ++-- drivers/net/ldpaa_eth/ls2080a.c | 4 ++-- drivers/net/ldpaa_eth/lx2160a.c | 4 ++-- drivers/net/macb.c | 2 +- drivers/net/mscc_eswitch/jr2_switch.c | 2 +- drivers/net/mscc_eswitch/luton_switch.c | 2 +- drivers/net/mscc_eswitch/ocelot_switch.c | 2 +- drivers/net/mscc_eswitch/serval_switch.c | 2 +- drivers/net/mscc_eswitch/servalt_switch.c | 2 +- drivers/net/mt7620-eth.c | 12 ++++++------ drivers/net/mtk_eth.c | 2 +- drivers/net/mvgbe.c | 2 +- drivers/net/mvneta.c | 2 +- drivers/net/mvpp2.c | 2 +- drivers/net/pic32_eth.c | 2 +- drivers/net/qe/dm_qe_uec.c | 2 +- drivers/net/ravb.c | 2 +- drivers/net/sh_eth.c | 2 +- drivers/net/sni_ave.c | 2 +- drivers/net/sni_netsec.c | 2 +- drivers/net/sun8i_emac.c | 2 +- drivers/net/ti/am65-cpsw-nuss.c | 2 +- drivers/net/ti/cpsw.c | 2 +- drivers/net/ti/keystone_net.c | 2 +- drivers/net/tsec.c | 2 +- drivers/net/xilinx_axi_emac.c | 2 +- drivers/net/zynq_gem.c | 2 +- include/dm/ofnode.h | 2 +- include/dm/read.h | 2 +- include/fm_eth.h | 2 +- include/phy_interface.h | 8 ++++---- include/vsc9953.h | 2 +- net/mdio-uclass.c | 4 ++-- 61 files changed, 105 insertions(+), 105 deletions(-)board/freescale/corenet_ds/eth_hydra.c +1
-1@@ -471,7 +471,7 @@ int board_eth_init(struct bd_info *bis)fm_info_set_mdio (i,miiphy_get_dev_by_name ("HYDRA_RGMII_MDIO" ));break ; -case PHY_INTERFACE_MODE_NONE : +case PHY_INTERFACE_MODE_NA :fm_info_set_phy_address (i,0 );break ;default :board/freescale/corenet_ds/eth_superhydra.c +2
-2@@ -583,7 +583,7 @@ int board_eth_init(struct bd_info *bis)fm_info_set_mdio (i,miiphy_get_dev_by_name ("SUPER_HYDRA_RGMII_MDIO" ));break ; -case PHY_INTERFACE_MODE_NONE : +case PHY_INTERFACE_MODE_NA :fm_info_set_phy_address (i,0 );break ;default :@@ -733,7 +733,7 @@ int board_eth_init(struct bd_info *bis)fm_info_set_mdio (i,miiphy_get_dev_by_name ("SUPER_HYDRA_RGMII_MDIO" ));break ; -case PHY_INTERFACE_MODE_NONE : +case PHY_INTERFACE_MODE_NA :fm_info_set_phy_address (i,0 );break ;default :board/freescale/t104xrdb/eth.c +2
-2@@ -89,7 +89,7 @@ int board_eth_init(struct bd_info *bis)case PHY_INTERFACE_MODE_QSGMII :fm_info_set_phy_address (i,0 );break ; -case PHY_INTERFACE_MODE_NONE : +case PHY_INTERFACE_MODE_NA :fm_info_set_phy_address (i,0 );break ;default :@@ -99,7 +99,7 @@ int board_eth_init(struct bd_info *bis)break ; }if (fm_info_get_enet_if (i) ==PHY_INTERFACE_MODE_QSGMII || -fm_info_get_enet_if (i) ==PHY_INTERFACE_MODE_NONE ) +fm_info_get_enet_if (i) ==PHY_INTERFACE_MODE_NA )fm_info_set_mdio (i,NULL );else fm_info_set_mdio(i,drivers/core/ofnode.c +2
-2@@ -1196,7 +1196,7 @@ phy_interface_t ofnode_read_phy_mode(ofnode node) mode =ofnode_read_string (node,"phy-connection-type" );if (!mode) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;for (i =0 ; i <PHY_INTERFACE_MODE_MAX ; i++)if (!strcmp (mode, phy_interface_strings[i]))@@ -1204,5 +1204,5 @@ phy_interface_t ofnode_read_phy_mode(ofnode node)debug ("%s: Invalid PHY interface '%s'\n" , __func__, mode); -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/ag7xxx.c +1
-1@@ -1265,7 +1265,7 @@ static int ag7xxx_eth_of_to_plat(struct udevice *dev)return ret; pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;return 0 ;drivers/net/altera_tse.c +1
-1@@ -678,7 +678,7 @@ static int altera_tse_of_to_plat(struct udevice *dev)struct eth_pdata *pdata =dev_get_plat (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;return 0 ;drivers/net/bcm6348-eth.c +1
-1@@ -425,7 +425,7 @@ static int bcm6348_eth_probe(struct udevice *dev)/* get phy mode */ pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -ENODEV ;/* get phy */ drivers/net/bcmgenet.c +1
-1@@ -696,7 +696,7 @@ static int bcmgenet_eth_of_to_plat(struct udevice *dev)/* Get phy mode from DT */ pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; ret = dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,drivers/net/designware.c +1
-1@@ -921,7 +921,7 @@ int designware_eth_of_to_plat(struct udevice *dev) pdata->iobase =dev_read_addr (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; pdata->max_speed =dev_read_u32_default (dev,"max-speed" ,0 );drivers/net/dwc_eth_qos.c +2
-2@@ -1682,7 +1682,7 @@ static int eqos_probe_resources_stm32(struct udevice *dev) interface = eqos->config->interface (dev); -if (interface ==PHY_INTERFACE_MODE_NONE ) { +if (interface ==PHY_INTERFACE_MODE_NA ) {pr_err ("Invalid PHY interface\n" );return -EINVAL ; }@@ -1743,7 +1743,7 @@ static int eqos_probe_resources_imx(struct udevice *dev) interface = eqos->config->interface (dev); -if (interface ==PHY_INTERFACE_MODE_NONE ) { +if (interface ==PHY_INTERFACE_MODE_NA ) {pr_err ("Invalid PHY interface\n" );return -EINVAL ; }drivers/net/fec_mxc.c +1
-1@@ -1563,7 +1563,7 @@ static int fecmxc_of_to_plat(struct udevice *dev) priv->eth = (struct ethernet_regs *)pdata->iobase; pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;#ifdef CONFIG_DM_REGULATOR drivers/net/fm/b4860.c +4
-4@@ -55,7 +55,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)#endif if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;/*B4860 has two 10Gig Mac*/ if ((port == FM1_10GEC1 || port == FM1_10GEC2) &&@@ -112,7 +112,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port) (port ==FM1_DTSEC2 ) || (port ==FM1_DTSEC3 ) || (port == FM1_DTSEC4)) - return PHY_INTERFACE_MODE_NONE; + return PHY_INTERFACE_MODE_NA; } } }@@ -131,8 +131,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_SGMII ;break ;default : -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/init.c +4
-4@@ -130,7 +130,7 @@ static int fm_port_to_index(enum fm_port port)/* * Determine if an interface is actually active based on HW config -* we expect fman_port_enet_if() to report PHY_INTERFACE_MODE_NONE if +* we expect fman_port_enet_if() to report PHY_INTERFACE_MODE_NA if * the interface is not active based on HW cfg of the SoC */ void fman_enet_init (void )@@ -141,7 +141,7 @@ void fman_enet_init(void)phy_interface_t enet_if; enet_if =fman_port_enet_if (fm_info[i].port); -if (enet_if !=PHY_INTERFACE_MODE_NONE ) { +if (enet_if !=PHY_INTERFACE_MODE_NA ) { fm_info[i].enabled =1 ; fm_info[i].enet_if = enet_if; }else {@@ -221,12 +221,12 @@ phy_interface_t fm_info_get_enet_if(enum fm_port port)int i =fm_port_to_index (port);if (i ==-1 ) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if (fm_info[i].enabled)return fm_info[i].enet_if; -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } static voiddrivers/net/fm/ls1043.c +3
-3@@ -54,13 +54,13 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr13 =in_be32 (&gur->rcwsr[13 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC1 ) && (is_serdes_configured (XFI_FM1_MAC9 )))return PHY_INTERFACE_MODE_XGMII ;if ((port ==FM1_DTSEC9 ) && (is_serdes_configured (XFI_FM1_MAC9 ))) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if (port ==FM1_DTSEC3 ) if ((rcwsr13 & FSL_CHASSIS2_RCWSR13_EC1) ==@@ -107,5 +107,5 @@ phy_interface_t fman_port_enet_if(enum fm_port port)break ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/ls1046.c +4
-4@@ -54,19 +54,19 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr13 =in_be32 (&gur->rcwsr[13 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC1 ) && (is_serdes_configured (XFI_FM1_MAC9 )))return PHY_INTERFACE_MODE_XGMII ;if ((port ==FM1_DTSEC9 ) && (is_serdes_configured (XFI_FM1_MAC9 ))) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC2 ) && (is_serdes_configured (XFI_FM1_MAC10 )))return PHY_INTERFACE_MODE_XGMII ;if ((port ==FM1_DTSEC10 ) && (is_serdes_configured (XFI_FM1_MAC10 ))) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if (port ==FM1_DTSEC3 ) if ((rcwsr13 & FSL_CHASSIS2_RCWSR13_EC1) ==@@ -118,5 +118,5 @@ phy_interface_t fman_port_enet_if(enum fm_port port)break ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/p1023.c +2
-2@@ -46,7 +46,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 pordevsr =in_be32 (&gur->pordevsr);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;/* DTSEC1 can be SGMII, RGMII or RMII */ if (port ==FM1_DTSEC1 ) {@@ -68,5 +68,5 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_RGMII ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/p4080.c +3
-3@@ -54,7 +54,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr11 =in_be32 (&gur->rcwsr[11 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC1 ) && (is_serdes_configured (XAUI_FM1 )))return PHY_INTERFACE_MODE_XGMII ;@@ -91,8 +91,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_SGMII ;break ;default : -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/p5020.c +3
-3@@ -50,7 +50,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr11 =in_be32 (&gur->rcwsr[11 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC1 ) && (is_serdes_configured (XAUI_FM1 )))return PHY_INTERFACE_MODE_XGMII ;@@ -82,8 +82,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_SGMII ;break ;default : -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/p5040.c +3
-3@@ -56,7 +56,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr11 =in_be32 (&gur->rcwsr[11 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC1 ) && (is_serdes_configured (XAUI_FM1 )))return PHY_INTERFACE_MODE_XGMII ;@@ -99,8 +99,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_SGMII ;break ;default : -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/t1024.c +2
-2@@ -39,7 +39,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr13 =in_be32 (&gur->rcwsr[13 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if ((port ==FM1_10GEC1 ) && (is_serdes_configured (XFI_FM1_MAC1 )))return PHY_INTERFACE_MODE_XGMII ;@@ -83,5 +83,5 @@ phy_interface_t fman_port_enet_if(enum fm_port port)break ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/t1040.c +2
-2@@ -56,8 +56,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_SGMII ;break ;default : -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/t2080.c +3
-3@@ -47,7 +47,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr13 =in_be32 (&gur->rcwsr[13 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; if ((port == FM1_10GEC1 || port == FM1_10GEC2) && ((is_serdes_configured(XAUI_FM1_MAC9)) ||@@ -85,8 +85,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)return PHY_INTERFACE_MODE_SGMII ;break ;default : -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fm/t4240.c +3
-3@@ -61,7 +61,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)u32 rcwsr13 =in_be32 (&gur->rcwsr[13 ]);if (is_device_disabled (port)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; if ((port == FM1_10GEC1 || port == FM1_10GEC2) && ((is_serdes_configured(XAUI_FM1_MAC9)) ||@@ -73,7 +73,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)if ((port ==FM1_DTSEC9 || port ==FM1_DTSEC10 ) && ((is_serdes_configured (XFI_FM1_MAC9 )) || (is_serdes_configured (XFI_FM1_MAC10 )))) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; if ((port == FM2_10GEC1 || port == FM2_10GEC2) && ((is_serdes_configured(XAUI_FM2_MAC9)) ||@@ -166,5 +166,5 @@ phy_interface_t fman_port_enet_if(enum fm_port port)break ; } -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/fsl_enetc.c +1
-1@@ -277,7 +277,7 @@ static void enetc_start_pcs(struct udevice *dev) } priv->if_type =dev_read_phy_mode (dev); -if (priv->if_type ==PHY_INTERFACE_MODE_NONE ) { +if (priv->if_type ==PHY_INTERFACE_MODE_NA ) {enetc_dbg (dev,"phy-mode property not found, defaulting to SGMII\n" ); priv->if_type =PHY_INTERFACE_MODE_SGMII ;drivers/net/ftgmac100.c +1
-1@@ -553,7 +553,7 @@ static int ftgmac100_of_to_plat(struct udevice *dev) pdata->iobase =dev_read_addr (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; pdata->max_speed =dev_read_u32_default (dev,"max-speed" ,0 );drivers/net/higmacv300.c +1
-1@@ -567,7 +567,7 @@ static int higmac_of_to_plat(struct udevice *dev) priv->macif_ctrl =dev_remap_addr_index (dev,1 ); priv->phyintf =dev_read_phy_mode (dev); -if (priv->phyintf ==PHY_INTERFACE_MODE_NONE ) +if (priv->phyintf ==PHY_INTERFACE_MODE_NA )return -ENODEV ; phy_node =dev_read_subnode (dev,"phy" );drivers/net/ldpaa_eth/ldpaa_eth.c +1
-1@@ -1127,7 +1127,7 @@ static int ldpaa_eth_bind(struct udevice *dev)int phy_mode =-1 ; phy_mode =dev_read_phy_mode (dev); -if (phy_mode ==PHY_INTERFACE_MODE_NONE ) { +if (phy_mode ==PHY_INTERFACE_MODE_NA ) {dev_err (dev,"incorrect phy mode\n" );return -EINVAL ; }drivers/net/ldpaa_eth/ldpaa_wriop.c +5
-5@@ -16,7 +16,7 @@ struct wriop_dpmac_info dpmac_info[NUM_WRIOP_PORTS];__weak phy_interface_t wriop_dpmac_enet_if (int dpmac_id,int lane_prtc) { -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }void wriop_init_dpmac (int sd,int dpmac_id,int lane_prtcl)@@ -26,10 +26,10 @@ void wriop_init_dpmac(int sd, int dpmac_id, int lane_prtcl) dpmac_info[dpmac_id].enabled =0 ; dpmac_info[dpmac_id].id =0 ; - dpmac_info[dpmac_id].enet_if =PHY_INTERFACE_MODE_NONE ; + dpmac_info[dpmac_id].enet_if =PHY_INTERFACE_MODE_NA ; enet_if =wriop_dpmac_enet_if (dpmac_id, lane_prtcl); -if (enet_if !=PHY_INTERFACE_MODE_NONE ) { +if (enet_if !=PHY_INTERFACE_MODE_NA ) { dpmac_info[dpmac_id].enabled =1 ; dpmac_info[dpmac_id].id = dpmac_id; dpmac_info[dpmac_id].enet_if = enet_if;@@ -183,10 +183,10 @@ phy_interface_t wriop_get_enet_if(int dpmac_id)int i =wriop_dpmac_to_index (dpmac_id);if (i ==-1 ) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if (dpmac_info[i].enabled)return dpmac_info[i].enet_if; -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }drivers/net/ldpaa_eth/ls1088a.c +2
-2@@ -50,7 +50,7 @@ phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl)enum srds_prtcl ;if (is_device_disabled (dpmac_id +1 )) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;switch (lane_prtcl) {case SGMII1 :@@ -66,7 +66,7 @@ phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl)if (lane_prtcl >=QSGMII_A && lane_prtcl <=QSGMII_B )return PHY_INTERFACE_MODE_QSGMII ; -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }void wriop_init_dpmac_qsgmii (int sd,int lane_prtcl)drivers/net/ldpaa_eth/ls2080a.c +2
-2@@ -62,7 +62,7 @@ phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl)enum srds_prtcl ;if (is_device_disabled (dpmac_id +1 )) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if (lane_prtcl >=SGMII1 && lane_prtcl <=SGMII16 )return PHY_INTERFACE_MODE_SGMII ;@@ -76,7 +76,7 @@ phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl)if (lane_prtcl >=QSGMII_A && lane_prtcl <=QSGMII_D )return PHY_INTERFACE_MODE_QSGMII ; -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }void wriop_init_dpmac_qsgmii (int sd,int lane_prtcl)drivers/net/ldpaa_eth/lx2160a.c +2
-2@@ -58,7 +58,7 @@ phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl)enum srds_prtcl ;if (is_device_disabled (dpmac_id)) -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ;if (lane_prtcl >=SGMII1 && lane_prtcl <=SGMII18 )return PHY_INTERFACE_MODE_SGMII ;@@ -78,7 +78,7 @@ phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl)if (lane_prtcl >= _100GE1 && lane_prtcl <= _100GE2)return PHY_INTERFACE_MODE_CAUI4 ; -return PHY_INTERFACE_MODE_NONE ; +return PHY_INTERFACE_MODE_NA ; }#ifdef CONFIG_SYS_FSL_HAS_RGMII drivers/net/macb.c +1
-1@@ -1363,7 +1363,7 @@ static int macb_eth_probe(struct udevice *dev)int ret; macb->phy_interface =dev_read_phy_mode (dev); -if (macb->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (macb->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;/* Read phyaddr from DT */ drivers/net/mscc_eswitch/jr2_switch.c +1
-1@@ -954,7 +954,7 @@ static int jr2_probe(struct udevice *dev) phy =phy_connect (priv->ports[i].bus, priv->ports[i].phy_addr, dev, -PHY_INTERFACE_MODE_NONE ); +PHY_INTERFACE_MODE_NA );if (phy)board_phy_config (phy); }drivers/net/mscc_eswitch/luton_switch.c +1
-1@@ -685,7 +685,7 @@ static int luton_probe(struct udevice *dev) phy =phy_connect (priv->ports[i].bus, priv->ports[i].phy_addr, dev, -PHY_INTERFACE_MODE_NONE ); +PHY_INTERFACE_MODE_NA );if (phy && i >=MAX_INT_PORT )board_phy_config (phy); }drivers/net/mscc_eswitch/ocelot_switch.c +1
-1@@ -608,7 +608,7 @@ static int ocelot_probe(struct udevice *dev) phy =phy_connect (priv->ports[i].bus, priv->ports[i].phy_addr, dev, -PHY_INTERFACE_MODE_NONE ); +PHY_INTERFACE_MODE_NA );if (phy &&external_bus (priv, i))board_phy_config (phy); }drivers/net/mscc_eswitch/serval_switch.c +1
-1@@ -561,7 +561,7 @@ static int serval_probe(struct udevice *dev) phy =phy_connect (priv->ports[i].bus, priv->ports[i].phy_addr, dev, -PHY_INTERFACE_MODE_NONE ); +PHY_INTERFACE_MODE_NA );if (phy)board_phy_config (phy); }drivers/net/mscc_eswitch/servalt_switch.c +1
-1@@ -482,7 +482,7 @@ static int servalt_probe(struct udevice *dev)continue ;phy_connect (priv->ports[i].bus, priv->ports[i].phy_addr, dev, -PHY_INTERFACE_MODE_NONE ); +PHY_INTERFACE_MODE_NA ); }return 0 ;drivers/net/mt7620-eth.c +6
-6@@ -596,7 +596,7 @@ static int mt7620_setup_gmac_mode(struct mt7620_eth_priv *priv, u32 gmac,case PHY_INTERFACE_MODE_RGMII : ge_mode =MT7620_SYSC_GE_RGMII ;break ; -case PHY_INTERFACE_MODE_NONE : +case PHY_INTERFACE_MODE_NA :if (gmac ==2 ) ge_mode =MT7620_SYSC_GE_ESW_PHY ;else @@ -620,7 +620,7 @@ static void mt7620_gsw_setup_port(struct mt7620_eth_priv *priv, u32 port, {u32 pmcr; -if (port_cfg->mode ==PHY_INTERFACE_MODE_NONE ) { +if (port_cfg->mode ==PHY_INTERFACE_MODE_NA ) {if (port ==5 ) {gsw_write (priv,GSW_PMCR (port),FORCE_MODE );return ;@@ -666,7 +666,7 @@ static void mt7620_gsw_setup_phy_polling(struct mt7620_eth_priv *priv) {int phy_addr_st, phy_addr_end; -if (priv->port_cfg[0 ].mode ==PHY_INTERFACE_MODE_NONE ) +if (priv->port_cfg[0 ].mode ==PHY_INTERFACE_MODE_NA ) priv->ephy_num =NUM_FE_PHYS ;else priv->ephy_num =NUM_FE_PHYS -1 ;@@ -1057,7 +1057,7 @@ static int mt7620_eth_parse_gsw_port(struct mt7620_eth_priv *priv, u32 idx,case PHY_INTERFACE_MODE_MII :case PHY_INTERFACE_MODE_RMII :case PHY_INTERFACE_MODE_RGMII : -case PHY_INTERFACE_MODE_NONE : +case PHY_INTERFACE_MODE_NA :break ;default :dev_err (priv->dev,"mt7620_eth: unsupported phy-mode\n" );@@ -1128,14 +1128,14 @@ static int mt7620_eth_parse_gsw_cfg(struct udevice *dev)if (ret)return ret; }else { - priv->port_cfg[0 ].mode =PHY_INTERFACE_MODE_NONE ; + priv->port_cfg[0 ].mode =PHY_INTERFACE_MODE_NA ; } subnode =ofnode_find_subnode (dev_ofnode (dev),"port5" );if (ofnode_valid (subnode))return mt7620_eth_parse_gsw_port (priv,1 , subnode); - priv->port_cfg[1 ].mode =PHY_INTERFACE_MODE_NONE ; + priv->port_cfg[1 ].mode =PHY_INTERFACE_MODE_NA ;return 0 ; }drivers/net/mtk_eth.c +1
-1@@ -1449,7 +1449,7 @@ static int mtk_eth_of_to_plat(struct udevice *dev)/* Interface mode is required */ pdata->phy_interface =dev_read_phy_mode (dev); priv->phy_interface = pdata->phy_interface; -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) { +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA ) {printf ("error: phy-mode is not set\n" );return -EINVAL ; }drivers/net/mvgbe.c +1
-1@@ -1005,7 +1005,7 @@ static int mvgbe_of_to_plat(struct udevice *dev)/* Get phy-mode / phy_interface from DT */ pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA ) pdata->phy_interface =PHY_INTERFACE_MODE_GMII ; dmvgbe->phy_interface = pdata->phy_interface;drivers/net/mvneta.c +1
-1@@ -1804,7 +1804,7 @@ static int mvneta_of_to_plat(struct udevice *dev)/* Get phy-mode / phy_interface from DT */ pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;return 0 ;drivers/net/mvpp2.c +1
-1@@ -4820,7 +4820,7 @@ static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port) } port->phy_interface =dev_read_phy_mode (dev); -if (port->phy_interface ==PHY_INTERFACE_MODE_NONE ) { +if (port->phy_interface ==PHY_INTERFACE_MODE_NA ) {dev_err (dev,"incorrect phy mode\n" );return -EINVAL ; }drivers/net/pic32_eth.c +1
-1@@ -550,7 +550,7 @@ static int pic32_eth_probe(struct udevice *dev)/* get phy mode */ pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;/* get phy addr */ drivers/net/qe/dm_qe_uec.c +1
-1@@ -1137,7 +1137,7 @@ static int qe_uec_of_to_plat(struct udevice *dev) pdata->iobase = (phys_addr_t )devfdt_get_addr (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;return 0 ;drivers/net/ravb.c +1
-1@@ -679,7 +679,7 @@ int ravb_of_to_plat(struct udevice *dev) pdata->iobase =dev_read_addr (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; pdata->max_speed =1000 ;drivers/net/sh_eth.c +1
-1@@ -920,7 +920,7 @@ int sh_ether_of_to_plat(struct udevice *dev) pdata->iobase =dev_read_addr (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; pdata->max_speed =1000 ;drivers/net/sni_ave.c +1
-1@@ -749,7 +749,7 @@ static int ave_of_to_plat(struct udevice *dev) pdata->iobase =dev_read_addr (dev); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; pdata->max_speed =0 ;drivers/net/sni_netsec.c +1
-1@@ -1034,7 +1034,7 @@ static int netsec_of_to_plat(struct udevice *dev) priv->eeprom_base =dev_read_addr_index (dev,1 ) -EERPROM_MAP_OFFSET ; pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; if (!dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,drivers/net/sun8i_emac.c +1
-1@@ -947,7 +947,7 @@ static int sun8i_emac_eth_of_to_plat(struct udevice *dev) pdata->phy_interface =dev_read_phy_mode (dev);printf ("phy interface%d\n" , pdata->phy_interface); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;if (priv->variant ==H3_EMAC ) {drivers/net/ti/am65-cpsw-nuss.c +1
-1@@ -607,7 +607,7 @@ static int am65_cpsw_ofdata_parse_phy(struct udevice *dev)dev_read_u32 (dev,"reg" , &priv->port_id); pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) { +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA ) {dev_err (dev,"Invalid PHY mode, port %u\n" , priv->port_id);return -EINVAL ; }drivers/net/ti/cpsw.c +1
-1@@ -1345,7 +1345,7 @@ static int cpsw_eth_of_to_plat(struct udevice *dev) } pdata->phy_interface = data->slave_data[data->active_slave].phy_if; -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ;return 0 ;drivers/net/ti/keystone_net.c +1
-1@@ -728,7 +728,7 @@ static int ks2_eth_parse_slave_interface(int netcp, int slave, priv->has_mdio = true; }else if (priv->link_type ==LINK_TYPE_RGMII_LINK_MAC_PHY ) { priv->phy_if =ofnode_read_phy_mode (offset_to_ofnode (slave)); -if (priv->phy_if ==PHY_INTERFACE_MODE_NONE ) +if (priv->phy_if ==PHY_INTERFACE_MODE_NA ) priv->phy_if =PHY_INTERFACE_MODE_RGMII ; pdata->phy_interface = priv->phy_if;drivers/net/tsec.c +1
-1@@ -894,7 +894,7 @@ int tsec_probe(struct udevice *dev) priv->tbiaddr = tbiaddr; pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA ) pdata->phy_interface =tsec_get_interface (priv); priv->interface = pdata->phy_interface;drivers/net/xilinx_axi_emac.c +1
-1@@ -850,7 +850,7 @@ static int axi_emac_of_to_plat(struct udevice *dev) } pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; plat->eth_hasnobuf = fdtdec_get_bool(gd->fdt_blob, node,drivers/net/zynq_gem.c +1
-1@@ -859,7 +859,7 @@ static int zynq_gem_of_to_plat(struct udevice *dev) } pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NONE ) +if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA )return -EINVAL ; priv->interface = pdata->phy_interface;include/dm/ofnode.h +1
-1@@ -1226,7 +1226,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);include/dm/read.h +1
-1@@ -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);include/fm_eth.h +1
-1@@ -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) \include/phy_interface.h +4
-4@@ -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]; }include/vsc9953.h +1
-1@@ -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, \ }net/mdio-uclass.c +2
-3@@ -199,8 +199,8 @@ struct phy_device *dm_eth_phy_connect(struct udevice *ethdev) } interface =dev_read_phy_mode (ethdev); -if (interface ==PHY_INTERFACE_MODE_NONE ) -dev_dbg (ethdev,"can't find interface mode, default to NONE\n" ); +if (interface ==PHY_INTERFACE_MODE_NA ) +dev_dbg (ethdev,"can't find interface mode, default to NA\n" ); phy =dm_eth_connect_phy_handle (ethdev, interface); --
Quoted 2 lines
2.34.1
Re: [PATCH u-boot-net 10/14] phy: Move PHY_INTERFACE_MODE_NA to the beginning of the enum definition
In reply to Marek BehúnQuoted 54 lines · Marek Behún
From: Marek Behún <[email protected]>
Move
PHY_INTERFACE_MODE_NAto 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 usePHY_INTERFACE_MODE_MAXfor that now, and so we can move it.Signed-off-by Marek Behún <[email protected]>--- include/phy_interface.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)include/phy_interface.h +2
-4@@ -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_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: --
Quoted 2 lines
2.34.1
Re: [PATCH u-boot-net 11/14] net: phy: xilinx: Check interface type in ->config(), not ->probe()
In reply to Marek BehúnQuoted 41 lines · Marek Behún
From: Marek Behún <[email protected]>
We want to be able to have
phydev->interfaceuninitialized during ->probe(). We should assume thatphydev->interfaceis initialized only before ->config().Signed-off-by Marek Behún <[email protected]>--- drivers/net/phy/xilinx_gmii2rgmii.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/net/phy/xilinx_gmii2rgmii.c +5
-6@@ -26,6 +26,11 @@ static int xilinxgmiitorgmii_config(struct phy_device *phydev)debug ("%s\n" , __func__); +if (phydev->interface !=PHY_INTERFACE_MODE_GMII ) { +printf ("Incorrect interface type\n" ); +return -EINVAL ; + } +if (!ofnode_valid (node))return -EINVAL ;@@ -114,11 +119,6 @@ static int xilinxgmiitorgmii_probe(struct phy_device *phydev) {debug ("%s\n" , __func__); -if (phydev->interface !=PHY_INTERFACE_MODE_GMII ) { -printf ("Incorrect interface type\n" ); -return -EINVAL ; - } - phydev->flags |=PHY_FLAG_BROKEN_RESET ;return 0 ; --
Quoted 2 lines
2.34.1
Re: [PATCH u-boot-net 12/14] net: phy: use ->is_c45 instead of is_10g_interface()
In reply to Marek BehúnQuoted 71 lines · Marek Behún
From: Marek Behún <[email protected]>
Use
phydev->is_c45instead ofis_10g_interface(phydev->interface)to determine whether clause 45 protocol should be used.Signed-off-by Marek Behún <[email protected]>--- drivers/net/phy/phy.c | 8 ++++---- include/phy.h | 12 ------------ 2 files changed, 4 insertions(+), 16 deletions(-)drivers/net/phy/phy.c +4
-4@@ -632,10 +632,10 @@ static int phy_probe(struct phy_device *phydev)return err; } -static struct phy_driver *generic_for_interface (phy_interface_t interface) +static struct phy_driver *generic_for_phy (struct phy_device *phydev) {#ifdef CONFIG_PHYLIB_10G -if (is_10g_interface (interface)) +if (phydev->is_c45)return &gen10g_driver;#endif @@ -656,7 +656,7 @@ static struct phy_driver *get_phy_driver(struct phy_device *phydev, }/* If we made it here, there's no driver for this PHY */ -return generic_for_interface (interface); +return generic_for_phy (phydev); } static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,@@ -859,7 +859,7 @@ int phy_reset(struct phy_device *phydev)#ifdef CONFIG_PHYLIB_10G /* If it's 10G, we need to issue reset through one of the MMDs */ -if (is_10g_interface (phydev->interface)) { +if (phydev->is_c45) {if (!phydev->mmds)gen10g_discover_mmds (phydev);include/phy.h +0
-13@@ -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 /** --
Quoted 2 lines
2.34.1
Re: [PATCH u-boot-net 13/14] bcmgenet, sun8i_emac: Don't connect PHY two times
In reply to Marek BehúnQuoted 43 lines · Marek Behún
From: Marek Behún <[email protected]>
The bcmgenet and
sun8i_emacdrivers callphy_connect(), which finds / creates the PHY and also connects it to the eth device viaphy_connect_dev(), then set some phydev members (bcmgenet only), and then callphy_connect_dev()explicitly again.Drop the second
phy_connect_dev(), since it is unnecesary.Signed-off-by Marek Behún <[email protected]>--- drivers/net/bcmgenet.c | 2 -- drivers/net/sun8i_emac.c | 2 -- 2 files changed, 4 deletions(-)drivers/net/bcmgenet.c +0
-2@@ -526,8 +526,6 @@ static int bcmgenet_phy_init(struct bcmgenet_eth_priv *priv, void *dev) } phydev->advertising = phydev->supported; -phy_connect_dev (phydev, dev); - priv->phydev = phydev;phy_config (priv->phydev);drivers/net/sun8i_emac.c +0
-3@@ -391,8 +391,6 @@ static int sun8i_phy_init(struct emac_eth_dev *priv, void *dev)if (!phydev)return -ENODEV ; -phy_connect_dev (phydev, dev); - priv->phydev = phydev;phy_config (priv->phydev); --
Quoted 2 lines
2.34.1
Re: [PATCH u-boot-net 14/14] net: phy: don't require PHY interface mode during PHY creation
In reply to Marek BehúnQuoted 609 lines · Marek Behún
From: Marek Behún <[email protected]>
Currently we require PHY interface mode to be known when finding/creating the PHY - the functions
*phy_device_create()
*create_phy_by_mask()
*search_for_existing_phy()
*get_phy_device_by_mask()
*phy_find_by_mask()(this is the only one global)
all require the interface parameter, but the only thing done with it is that it is assigned tophydev->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(inphy_device_create()) to bePHY_INTERFACE_MODE_NA. Move the interface parameter tophy_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 fromphy_find_by_maskcall.Signed-off-by Marek Behún <[email protected]>--- board/CZ.NIC/turris_mox/turris_mox.c | 2 +- board/boundary/nitrogen6x/nitrogen6x.c | 2 +- board/gdsys/a38x/controlcenterdc.c | 7 ++- board/gdsys/a38x/ihs_phys.c | 6 +- drivers/net/altera_tse.c | 4 +- drivers/net/ethoc.c | 4 +- drivers/net/fec_mxc.c | 4 +- drivers/net/pch_gbe.c | 4 +- drivers/net/phy/phy.c | 86 +++++++++++--------------- drivers/net/phy/xilinx_gmii2rgmii.c | 4 +- drivers/net/ravb.c | 4 +- drivers/net/sh_eth.c | 4 +- drivers/net/sni_ave.c | 4 +- drivers/net/sunxi_emac.c | 5 +- include/_exports.h | 3 +- include/exports.h | 3 +- include/phy.h | 12 ++-- 17 files changed, 72 insertions(+), 86 deletions(-)board/CZ.NIC/turris_mox/turris_mox.c +1
-1@@ -396,7 +396,7 @@ static void mox_phy_leds_start_blinking(void)return ; } - phydev =phy_find_by_mask (bus,BIT (1 ),PHY_INTERFACE_MODE_RGMII ); + phydev =phy_find_by_mask (bus,BIT (1 ));if (!phydev) {printf ("Cannot get ethernet PHY!\n" );return ;board/boundary/nitrogen6x/nitrogen6x.c +1
-1@@ -345,7 +345,7 @@ int board_eth_init(struct bd_info *bis)if (!bus)return -EINVAL ;/* scan phy 4,5,6,7 */ - phydev =phy_find_by_mask (bus, (0xf <<4 ),PHY_INTERFACE_MODE_RGMII ); + phydev =phy_find_by_mask (bus, (0xf <<4 ));if (!phydev) { ret = -EINVAL ; goto free_bus;board/gdsys/a38x/controlcenterdc.c +4
-3@@ -194,11 +194,12 @@ void init_host_phys(struct mii_dev *bus)for (k =0 ; k <2 ; ++k) {struct phy_device *phydev; - phydev =phy_find_by_mask (bus,1 << k, -PHY_INTERFACE_MODE_SGMII ); + phydev =phy_find_by_mask (bus,1 << k); -if (phydev) +if (phydev) { + phydev->interface =PHY_INTERFACE_MODE_SGMII ;phy_config (phydev); + } } }board/gdsys/a38x/ihs_phys.c +3
-3@@ -28,6 +28,7 @@ static void ihs_phy_config(struct phy_device *phydev, bool qinpn, bool qoutpn) {u16 reg; + phydev->interface =PHY_INTERFACE_MODE_MII ;phy_config (phydev);/* enable QSGMII autonegotiation with flow control */ @@ -142,10 +143,9 @@ struct porttype *get_porttype(uint octo_phy_mask, uint k)int init_single_phy (struct porttype *porttype,struct mii_dev *bus,uint bus_idx,uint m,uint phy_idx) { -struct phy_device *phydev =phy_find_by_mask ( - bus,1 << (m *8 + phy_idx), -PHY_INTERFACE_MODE_MII ); +struct phy_device *phydev; + phydev =phy_find_by_mask (bus,BIT (m *8 + phy_idx));printf (" %u" , bus_idx *32 + m *8 + phy_idx);if (!phydev)drivers/net/altera_tse.c +2
-2@@ -435,11 +435,11 @@ static int tse_phy_init(struct altera_tse_priv *priv, void *dev)if (priv->phyaddr) mask =1 << priv->phyaddr; - phydev =phy_find_by_mask (priv->bus, mask, priv->interface); + phydev =phy_find_by_mask (priv->bus, mask);if (!phydev)return -ENODEV ; -phy_connect_dev (phydev, dev); +phy_connect_dev (phydev, dev, priv->interface); phydev->supported &=PHY_GBIT_FEATURES ; phydev->advertising = phydev->supported;drivers/net/ethoc.c +2
-2@@ -614,11 +614,11 @@ static int ethoc_phy_init(struct ethoc *priv, void *dev) mask =1 <<CONFIG_PHY_ADDR ;#endif - phydev =phy_find_by_mask (priv->bus, mask,PHY_INTERFACE_MODE_MII ); + phydev =phy_find_by_mask (priv->bus, mask);if (!phydev)return -ENODEV ; -phy_connect_dev (phydev, dev); +phy_connect_dev (phydev, dev,PHY_INTERFACE_MODE_MII ); phydev->supported &=PHY_BASIC_FEATURES ; phydev->advertising = phydev->supported;drivers/net/fec_mxc.c +2
-2@@ -1172,7 +1172,7 @@ static int fec_probe(struct bd_info *bd, int dev_id, uint32_t base_addr,fec_mii_setspeed (bus->priv);#ifdef CONFIG_PHYLIB fec->phydev = phydev; -phy_connect_dev (phydev, edev); +phy_connect_dev (phydev, edev,PHY_INTERFACE_MODE_RGMII );/* Configure phy */ phy_config (phydev);#else @@ -1234,7 +1234,7 @@ int fecmxc_initialize_multi(struct bd_info *bd, int dev_id, int phy_id,if (!bus)return -ENOMEM ;#ifdef CONFIG_PHYLIB - phydev =phy_find_by_mask (bus,1 << phy_id,PHY_INTERFACE_MODE_RGMII ); + phydev =phy_find_by_mask (bus,1 << phy_id);if (!phydev) {mdio_unregister (bus);free (bus);drivers/net/pch_gbe.c +2
-2@@ -416,13 +416,13 @@ static int pch_gbe_phy_init(struct udevice *dev)struct phy_device *phydev;int mask =0xffffffff ; - phydev =phy_find_by_mask (priv->bus, mask, plat->phy_interface); + phydev =phy_find_by_mask (priv->bus, mask);if (!phydev) {printf ("pch_gbe: cannot find the phy\n" );return -1 ; } -phy_connect_dev (phydev, dev); +phy_connect_dev (phydev, dev, plat->phy_interface); phydev->supported &=PHY_GBIT_FEATURES ; phydev->advertising = phydev->supported;drivers/net/phy/phy.c +36
-50@@ -642,8 +642,7 @@ static struct phy_driver *generic_for_phy(struct phy_device *phydev)return &genphy_driver; } -static struct phy_driver *get_phy_driver (struct phy_device *phydev, -phy_interface_t interface) +static struct phy_driver *get_phy_driver (struct phy_device *phydev) {struct list_head *entry;int phy_id = phydev->phy_id;@@ -660,8 +659,7 @@ static struct phy_driver *get_phy_driver(struct phy_device *phydev, }static 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) {struct phy_device *dev;@@ -680,7 +678,7 @@ static struct phy_device *phy_device_create(struct mii_dev *bus, int addr, dev->duplex =-1 ; dev->link =0 ; - dev->interface = interface; + dev->interface =PHY_INTERFACE_MODE_NA ;#ifdef CONFIG_DM_ETH dev->node =ofnode_null ();@@ -693,7 +691,7 @@ static struct phy_device *phy_device_create(struct mii_dev *bus, int addr, dev->is_c45 = is_c45; dev->bus = bus; - dev->drv =get_phy_driver (dev, interface); + dev->drv =get_phy_driver (dev);if (phy_probe (dev)) {printf ("%s, PHY probe failed\n" , __func__);@@ -742,8 +740,7 @@ int __weak get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id) }static struct phy_device *create_phy_by_mask (struct mii_dev *bus, -uint phy_mask,int devad, -phy_interface_t interface) +uint phy_mask,int devad) {u32 phy_id =0xffffffff ;bool is_c45;@@ -764,8 +761,7 @@ static struct phy_device *create_phy_by_mask(struct mii_dev *bus,/* If the PHY ID is mostly f's, we didn't find anything */ if (r ==0 && (phy_id &0x1fffffff ) !=0x1fffffff ) { is_c45 = (devad ==MDIO_DEVAD_NONE ) ? false : true; -return phy_device_create (bus, addr, phy_id, is_c45, - interface); +return phy_device_create (bus, addr, phy_id, is_c45); } next: phy_mask &= ~(1 << addr);@@ -774,25 +770,22 @@ next: }static struct phy_device *search_for_existing_phy (struct mii_dev *bus, -uint phy_mask, -phy_interface_t interface) +uint phy_mask) {/* If we have one, return the existing device, with new interface */ while (phy_mask) {int addr =ffs (phy_mask) -1 ; -if (bus->phymap[addr]) { - bus->phymap[addr]->interface = interface; +if (bus->phymap[addr])return bus->phymap[addr]; - } + phy_mask &= ~(1 << addr); }return NULL ; }static struct phy_device *get_phy_device_by_mask (struct mii_dev *bus, -uint phy_mask, -phy_interface_t interface) +uint phy_mask) {struct phy_device *phydev;int devad[] = {@@ -808,13 +801,12 @@ static struct phy_device *get_phy_device_by_mask(struct mii_dev *bus,int i, devad_cnt; devad_cnt =sizeof (devad)/sizeof (int ); - phydev =search_for_existing_phy (bus, phy_mask, interface); + phydev =search_for_existing_phy (bus, phy_mask);if (phydev)return phydev;/* try different access clauses */ for (i =0 ; i < devad_cnt; i++) { - phydev =create_phy_by_mask (bus, phy_mask, - devad[i], interface); + phydev =create_phy_by_mask (bus, phy_mask, devad[i]);if (IS_ERR (phydev))return NULL ;if (phydev)@@ -842,10 +834,9 @@ static struct phy_device *get_phy_device_by_mask(struct mii_dev *bus,* Description: Reads the ID registers of the PHY at @addr on the * @bus, then allocates and returns the phy_device to represent it. */ -static struct phy_device *get_phy_device (struct mii_dev *bus,int addr, -phy_interface_t interface) +static struct phy_device *get_phy_device (struct mii_dev *bus,int addr) { -return get_phy_device_by_mask (bus,1 << addr, interface); +return get_phy_device_by_mask (bus,1 << addr); }int phy_reset (struct phy_device *phydev)@@ -904,18 +895,12 @@ int miiphy_reset(const char *devname, unsigned char addr)struct mii_dev *bus =miiphy_get_dev_by_name (devname);struct phy_device *phydev; -/* -* miiphy_reset was only used on standard PHYs, so we'll fake it here. -* If later code tries to connect with the right interface, this will -* be corrected by get_phy_device in phy_connect() -*/ - phydev =get_phy_device (bus, addr,PHY_INTERFACE_MODE_MII ); + phydev =get_phy_device (bus, addr);return phy_reset (phydev); } -struct phy_device *phy_find_by_mask (struct mii_dev *bus,uint phy_mask, -phy_interface_t interface) +struct phy_device *phy_find_by_mask (struct mii_dev *bus,uint phy_mask) {/* Reset the bus */ if (bus->reset) {@@ -925,13 +910,15 @@ struct phy_device *phy_find_by_mask(struct mii_dev *bus, uint phy_mask,mdelay (15 ); } -return get_phy_device_by_mask (bus, phy_mask, interface); +return get_phy_device_by_mask (bus, phy_mask); }#ifdef CONFIG_DM_ETH -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)#else -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)#endif {/* Soft Reset the PHY */ @@ -942,13 +929,14 @@ void phy_connect_dev(struct phy_device *phydev, struct eth_device *dev) phydev->dev->name, dev->name); } phydev->dev = dev; -debug ("%s connected to %s\n" , dev->name, phydev->drv->name); + phydev->interface = interface; +debug ("%s connected to %s mode %s\n" , dev->name, phydev->drv->name, +phy_string_for_interface (interface)); }#ifdef CONFIG_PHY_XILINX_GMII2RGMII static struct phy_device *phy_connect_gmii2rgmii (struct mii_dev *bus, -struct udevice *dev, -phy_interface_t interface) +struct udevice *dev) {struct phy_device *phydev =NULL ;ofnode node;@@ -957,8 +945,7 @@ static struct phy_device *phy_connect_gmii2rgmii(struct mii_dev *bus, node =ofnode_by_compatible (node,"xlnx,gmii-to-rgmii-1.0" );if (ofnode_valid (node)) { phydev =phy_device_create (bus,0 , -PHY_GMII2RGMII_ID , false, - interface); +PHY_GMII2RGMII_ID , false);if (phydev) phydev->node = node;break ;@@ -990,24 +977,23 @@ struct phy_device *fixed_phy_create(ofnode node)return NULL ; } - phydev =phy_device_create (NULL ,0 ,PHY_FIXED_ID , false, -ofnode_read_phy_mode (node)); + phydev =phy_device_create (NULL ,0 ,PHY_FIXED_ID , false);if (phydev) phydev->node = subnode; + phydev->interface =ofnode_read_phy_mode (node); +return phydev; }static struct phy_device *phy_connect_fixed (struct mii_dev *bus, -struct udevice *dev, -phy_interface_t interface) +struct udevice *dev) {ofnode node =dev_ofnode (dev), subnode;struct phy_device *phydev =NULL ;if (ofnode_phy_is_fixed_link (node, &subnode)) { - phydev =phy_device_create (bus,0 ,PHY_FIXED_ID , - false, interface); + phydev =phy_device_create (bus,0 ,PHY_FIXED_ID , false);if (phydev) phydev->node = subnode; }@@ -1030,24 +1016,24 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,uint mask = (addr >=0 ) ? (1 << addr) :0xffffffff ;#ifdef CONFIG_PHY_FIXED - phydev =phy_connect_fixed (bus, dev, interface); + phydev =phy_connect_fixed (bus, dev);#endif #ifdef CONFIG_PHY_NCSI if (!phydev) - phydev =phy_device_create (bus,0 ,PHY_NCSI_ID , false, interface); + phydev =phy_device_create (bus,0 ,PHY_NCSI_ID , false);#endif #ifdef CONFIG_PHY_XILINX_GMII2RGMII if (!phydev) - phydev =phy_connect_gmii2rgmii (bus, dev, interface); + phydev =phy_connect_gmii2rgmii (bus, dev);#endif if (!phydev) - phydev =phy_find_by_mask (bus, mask, interface); + phydev =phy_find_by_mask (bus, mask);if (phydev) -phy_connect_dev (phydev, dev); +phy_connect_dev (phydev, dev, interface);else printf ("Could not get PHY for %s: addr %d\n" , bus->name, addr);return phydev;drivers/net/phy/xilinx_gmii2rgmii.c +2
-2@@ -42,13 +42,13 @@ static int xilinxgmiitorgmii_config(struct phy_device *phydev) ext_phyaddr =ofnode_read_u32_default (phandle.node,"reg" ,-1 ); ext_phydev =phy_find_by_mask (phydev->bus, -1 << ext_phyaddr, -PHY_INTERFACE_MODE_RGMII ); +1 << ext_phyaddr);if (!ext_phydev) {printf ("%s, No external phy device found\n" , __func__);return -EINVAL ; } + ext_phydev->interface =PHY_INTERFACE_MODE_RGMII ; ext_phydev->node = phandle.node; phydev->priv = ext_phydev;drivers/net/ravb.c +2
-2@@ -319,11 +319,11 @@ static int ravb_phy_config(struct udevice *dev)mdelay (1 ); } - phydev =phy_find_by_mask (eth->bus, mask, pdata->phy_interface); + phydev =phy_find_by_mask (eth->bus, mask);if (!phydev)return -ENODEV ; -phy_connect_dev (phydev, dev); +phy_connect_dev (phydev, dev, pdata->phy_interface); eth->phydev = phydev;drivers/net/sh_eth.c +2
-2@@ -762,11 +762,11 @@ static int sh_eth_phy_config(struct udevice *dev)struct phy_device *phydev;int mask =0xffffffff ; - phydev =phy_find_by_mask (priv->bus, mask, pdata->phy_interface); + phydev =phy_find_by_mask (priv->bus, mask);if (!phydev)return -ENODEV ; -phy_connect_dev (phydev, dev); +phy_connect_dev (phydev, dev, pdata->phy_interface); port_info->phydev = phydev;phy_config (phydev);drivers/net/sni_ave.c +2
-2@@ -393,11 +393,11 @@ static int ave_phy_init(struct ave_private *priv, void *dev)struct phy_device *phydev;int mask =GENMASK (31 ,0 ), ret; - phydev =phy_find_by_mask (priv->bus, mask, priv->phy_mode); + phydev =phy_find_by_mask (priv->bus, mask);if (!phydev)return -ENODEV ; -phy_connect_dev (phydev, dev); +phy_connect_dev (phydev, dev, priv->phy_mode); phydev->supported &=PHY_GBIT_FEATURES ;if (priv->max_speed) {drivers/net/sunxi_emac.c +2
-3@@ -272,12 +272,11 @@ static int sunxi_emac_init_phy(struct emac_eth_dev *priv, void *dev)if (ret)return ret; - priv->phydev =phy_find_by_mask (priv->bus, mask, -PHY_INTERFACE_MODE_MII ); + priv->phydev =phy_find_by_mask (priv->bus, mask);if (!priv->phydev)return -ENODEV ; -phy_connect_dev (priv->phydev, dev); +phy_connect_dev (priv->phydev, dev,PHY_INTERFACE_MODE_MII );phy_config (priv->phydev);return 0 ;include/_exports.h +1
-2@@ -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,include/exports.h +1
-2@@ -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 include/phy.h +7
-6@@ -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 @@ -456,8 +456,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 --
Quoted 2 lines
2.34.1
Quoted 115 lines · Marek Behún
From: Marek Behún <[email protected]>
So I wanted to solve a problem regarding MDIO bus within mvneta driver, to make it use the mvmdio DM driver instead of the non-DM MDIO bus registered during mvneta probe, and improve some other things there, and it seems like I opened a small bag from hell, which resulted in this series of refactors, fixes and cleanups in the network subsystem.
The series applies on Tom's master branch. It won't apply to u-boot-next's master nor net, those are too old.
This series was CI tested (https://github.com/u-boot/u-boot/pull/142).
Marek Behún (14):
net: mdio-uclass: fix type forphy_mode_strandphy_handle_str
net: mdio-uclass: useARRAY_SIZE()
net: introduce helpers to get PHY ofnode from MAC
net: mdio-uclass: add wrappers for read/write/reset operations
treewide: use dm_mdio_read/write/reset() wrappers
net: phy: fix parsing wrong property
net: introduce helpers to get PHY interface mode from a device/ofnode
treewide: RenamePHY_INTERFACE_MODE_COUNTtoPHY_INTERFACE_MODE_MAX
treewide: RenamePHY_INTERFACE_MODE_NONEtoPHY_INTERFACE_MODE_NA
phy: MovePHY_INTERFACE_MODE_NAto the beginning of the enum
definition
net: phy: xilinx: Check interface type in ->config(), not ->probe()
net: phy: use ->is_c45 instead ofis_10g_interface()bcmgenet,sun8i_emac: Don't connect PHY two times
net: phy: don't require PHY interface mode during PHY creationboard/CZ.NIC/turris_mox/turris_mox.c | 2 +- board/boundary/nitrogen6x/nitrogen6x.c | 2 +- board/freescale/corenet_ds/eth_hydra.c | 2 +- board/freescale/corenet_ds/eth_superhydra.c | 4 +- board/freescale/t104xrdb/eth.c | 4 +- board/gdsys/a38x/controlcenterdc.c | 7 +- board/gdsys/a38x/ihs_phys.c | 6 +- board/st/stm32f746-disco/stm32f746-disco.c | 13 +-- drivers/core/ofnode.c | 44 ++++++++ drivers/core/read.c | 10 ++ drivers/net/ag7xxx.c | 9 +- drivers/net/altera_tse.c | 17 +-- drivers/net/bcm6348-eth.c | 8 +- drivers/net/bcmgenet.c | 12 +- drivers/net/designware.c | 10 +- drivers/net/dwc_eth_qos.c | 40 +------ drivers/net/ethoc.c | 4 +- drivers/net/fec_mxc.c | 15 +-- drivers/net/fm/b4860.c | 8 +- drivers/net/fm/eth.c | 13 +-- drivers/net/fm/init.c | 8 +- drivers/net/fm/ls1043.c | 6 +- drivers/net/fm/ls1046.c | 8 +- drivers/net/fm/p1023.c | 4 +- drivers/net/fm/p4080.c | 6 +- drivers/net/fm/p5020.c | 6 +- drivers/net/fm/p5040.c | 6 +- drivers/net/fm/t1024.c | 4 +- drivers/net/fm/t1040.c | 4 +- drivers/net/fm/t2080.c | 6 +- drivers/net/fm/t4240.c | 6 +- drivers/net/fsl_enetc.c | 13 +-- drivers/net/ftgmac100.c | 11 +- drivers/net/higmacv300.c | 9 +- drivers/net/ldpaa_eth/ldpaa_eth.c | 28 +---- drivers/net/ldpaa_eth/ldpaa_wriop.c | 10 +- drivers/net/ldpaa_eth/ls1088a.c | 4 +- drivers/net/ldpaa_eth/ls2080a.c | 4 +- drivers/net/ldpaa_eth/lx2160a.c | 4 +- drivers/net/macb.c | 10 +- drivers/net/mdio_mux_sandbox.c | 6 +- drivers/net/mscc_eswitch/jr2_switch.c | 2 +- drivers/net/mscc_eswitch/luton_switch.c | 2 +- drivers/net/mscc_eswitch/ocelot_switch.c | 2 +- drivers/net/mscc_eswitch/serval_switch.c | 2 +- drivers/net/mscc_eswitch/servalt_switch.c | 2 +- drivers/net/mt7620-eth.c | 45 +++----- drivers/net/mtk_eth.c | 8 +- drivers/net/mvgbe.c | 7 +- drivers/net/mvneta.c | 11 +- drivers/net/mvpp2.c | 9 +- drivers/net/pch_gbe.c | 4 +- drivers/net/phy/aquantia.c | 2 +- drivers/net/phy/phy.c | 115 +++++++------------- drivers/net/phy/xilinx_gmii2rgmii.c | 14 +-- drivers/net/pic32_eth.c | 11 +- drivers/net/qe/dm_qe_uec.c | 11 +- drivers/net/ravb.c | 19 +--- drivers/net/sh_eth.c | 19 +--- drivers/net/sni_ave.c | 16 +-- drivers/net/sni_netsec.c | 10 +- drivers/net/sun8i_emac.c | 13 +-- drivers/net/sunxi_emac.c | 5 +- drivers/net/ti/am65-cpsw-nuss.c | 15 +-- drivers/net/ti/cpsw.c | 10 +- drivers/net/ti/keystone_net.c | 24 ++-- drivers/net/tsec.c | 9 +- drivers/net/xilinx_axi_emac.c | 10 +- drivers/net/zynq_gem.c | 9 +- include/_exports.h | 3 +- include/dm/ofnode.h | 27 +++++ include/dm/read.h | 36 ++++++ include/exports.h | 3 +- include/fm_eth.h | 2 +- include/miiphy.h | 31 ++++++ include/phy.h | 32 ++---- include/phy_interface.h | 11 +- include/vsc9953.h | 2 +- net/mdio-mux-uclass.c | 16 +-- net/mdio-uclass.c | 96 ++++++++-------- test/dm/mdio.c | 18 +-- test/dm/mdio_mux.c | 16 +-- 82 files changed, 469 insertions(+), 623 deletions(-)
Quoted 3 lines
--
2.34.1
Awesome. Thanks !
Re: [PATCH u-boot-net 03/14] net: introduce helpers to get PHY ofnode from MAC
In reply to Marek BehúnHi Marek,
Quoted 9 lines · Marek Behún
From: Marek Behún <[email protected]>
Add helpers
ofnode_get_phy_node()anddev_get_phy_node()and use it innet/mdio-uclass.cfunctiondm_eth_connect_phy_handle().This is useful because other part's of U-Boot may want to get PHY ofnode without connecting a PHY.
Quoted 8 lines
Signed-off-by Marek Behún <[email protected]>--- drivers/core/ofnode.c | 21 +++++++++++++++++++++ drivers/core/read.c | 5 +++++ include/dm/ofnode.h | 14 ++++++++++++++ include/dm/read.h | 19 +++++++++++++++++++ net/mdio-uclass.c | 24 ++++++------------------ 5 files changed, 65 insertions(+), 18 deletions(-)
Please add a test for your new function. With that:
Re: [PATCH u-boot-net 03/14] net: introduce helpers to get PHY ofnode from MAC
Quoted 21 lines · On Mon, 28 Mar 2022 00:35:00 -0600 Simon Glass <[email protected]> wrote:
Hi Marek,
Quoted 9 lines · Marek Behún
From: Marek Behún <[email protected]>
Add helpers
ofnode_get_phy_node()anddev_get_phy_node()and use it innet/mdio-uclass.cfunctiondm_eth_connect_phy_handle().This is useful because other part's of U-Boot may want to get PHY ofnode without connecting a PHY.
Quoted 8 lines
Signed-off-by Marek Behún <[email protected]>--- drivers/core/ofnode.c | 21 +++++++++++++++++++++ drivers/core/read.c | 5 +++++ include/dm/ofnode.h | 14 ++++++++++++++ include/dm/read.h | 19 +++++++++++++++++++ net/mdio-uclass.c | 24 ++++++------------------ 5 files changed, 65 insertions(+), 18 deletions(-)
Quoted 3 lines
Please add a test for your new function. With that:
Reviewed-by Simon Glass <[email protected]>
Dear Simon,
OK, I added test for ofnode_get_phy_node(). Should I also add one for dev_get_phy_node() ? That one is implemented in drivers/core/read.c or include/dm/read.h, and it just calls ofnode_get_phy_node()...
Also adding test for ofnode_get_phy_mode() (node -> mode) which is implemented in patch 07/14. Can I add your reviewde-by for that patch also? That patch is rather big, touches many files treewide...
Marek