net: ksz9477: remove unnecessary dsa_set_tagging call
PATCH 1/3 net: ksz9477: remove unnecessary dsa_set_tagging call
packet tagging is not used for this driver so we do not need to call dsa_set_tagging.
--- drivers/net/ksz9477.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ksz9477.c +0 -2
@@ -501,8 +501,6 @@ static int ksz_i2c_probe(struct udevice *dev)ksz_pwrite8 (priv->dev, i,REG_PORT_MSTP_STATE , data8); } -dsa_set_tagging (dev,0 ,0 ); -return 0 ; };
Signature · 1 line
2.25.1
PATCH 2/3 net: ksz9477: remove unnecessary variable
We don't do anything useful with the master dev, so remove the variable.
--- drivers/net/ksz9477.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/net/ksz9477.c +0 -5
@@ -443,15 +443,10 @@ static int ksz_i2c_probe(struct udevice *dev) {struct dsa_pdata *pdata =dev_get_uclass_plat (dev);struct ksz_dsa_priv *priv =dev_get_priv (dev); -struct udevice *master =dsa_get_master (dev);int i, ret;u8 data8;u32 id; -if (!master) -return -ENODEV ; - -dev_dbg (dev,"%s %s master:%s\n" , __func__, dev->name, master->name);dev_set_parent_priv (dev, priv); ret =i2c_set_chip_offset_len (dev,2 );
Signature · 1 line
2.25.1
Re: [PATCH 2/3] net: ksz9477: remove unnecessary variable
Quoted 29 lines · Tim Harvey
We don't do anything useful with the master dev, so remove the variable.
Signed-off-by Tim Harvey <[email protected]>--- drivers/net/ksz9477.c | 5 ----- 1 file changed, 5 deletions(-)drivers/net/ksz9477.c +0
-6@@ -443,15 +443,10 @@ static int ksz_i2c_probe(struct udevice *dev) {struct dsa_pdata *pdata =dev_get_uclass_plat (dev);struct ksz_dsa_priv *priv =dev_get_priv (dev); -struct udevice *master =dsa_get_master (dev);int i, ret;u8 data8;u32 id; -if (!master) -return -ENODEV ; - -dev_dbg (dev,"%s %s master:%s\n" , __func__, dev->name, master->name);dev_set_parent_priv (dev, priv); ret =i2c_set_chip_offset_len (dev,2 ); --
Quoted 2 lines
2.25.1
PATCH 3/3 net: ksz9477: add port_probe function to config phy
In reply to Tim HarveyAdd a port_probe function to configure the phy. This leads to earlier link negotiation so the port is more likely to be ready when used.
--- drivers/net/ksz9477.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/net/ksz9477.c +13 -13
@@ -337,11 +337,21 @@ static int ksz_port_setup(struct udevice *dev, int port,return 0 ; } +static int ksz_port_probe (struct udevice *dev,int port,struct phy_device *phy) +{ +int supported =PHY_GBIT_FEATURES ; + +/* configure phy */ + phy->supported &= supported; + phy->advertising &= supported; + +return phy_config (phy); +} +static int ksz_port_enable (struct udevice *dev,int port,struct phy_device *phy) {struct dsa_pdata *pdata =dev_get_uclass_plat (dev);struct ksz_dsa_priv *priv =dev_get_priv (dev); -int supported =PHY_GBIT_FEATURES ;u8 data8;int ret;
@@ -365,23 +375,12 @@ static int ksz_port_enable(struct udevice *dev, int port, struct phy_device *phyif (port == pdata->cpu_port)return 0 ; -/* configure phy */ - phy->supported &= supported; - phy->advertising &= supported; - ret =phy_config (phy); -if (ret) -return ret; - - ret =phy_startup (phy); -if (ret) -return ret; -/* start switch */ ksz_read8 (priv->dev,REG_SW_OPERATION , &data8); data8 |=SW_START ;ksz_write8 (priv->dev,REG_SW_OPERATION , data8); -return 0 ; +return phy_startup (phy); }static void ksz_port_disable (struct udevice *dev,int port,struct phy_device *phy)
@@ -410,6 +409,7 @@ static void ksz_port_disable(struct udevice *dev, int port, struct phy_device *p }static const struct dsa_ops ksz_dsa_ops = { + .port_probe = ksz_port_probe, .port_enable = ksz_port_enable, .port_disable = ksz_port_disable, };
Signature · 1 line
2.25.1
Re: [PATCH 3/3] net: ksz9477: add port_probe function to config phy
Quoted 71 lines · Tim Harvey
Add a
port_probefunction to configure the phy. This leads to earlier link negotiation so the port is more likely to be ready when used.Signed-off-by Tim Harvey <[email protected]>--- drivers/net/ksz9477.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)drivers/net/ksz9477.c +13
-14@@ -337,11 +337,21 @@ static int ksz_port_setup(struct udevice *dev, int port,return 0 ; } +static int ksz_port_probe (struct udevice *dev,int port,struct phy_device *phy) +{ +int supported =PHY_GBIT_FEATURES ; + +/* configure phy */ + phy->supported &= supported; + phy->advertising &= supported; + +return phy_config (phy); +} +static int ksz_port_enable (struct udevice *dev,int port,struct phy_device *phy) {struct dsa_pdata *pdata =dev_get_uclass_plat (dev);struct ksz_dsa_priv *priv =dev_get_priv (dev); -int supported =PHY_GBIT_FEATURES ;u8 data8;int ret;@@ -365,23 +375,12 @@ static int ksz_port_enable(struct udevice *dev, int port, struct phy_device *phyif (port == pdata->cpu_port)return 0 ; -/* configure phy */ - phy->supported &= supported; - phy->advertising &= supported; - ret =phy_config (phy); -if (ret) -return ret; - - ret =phy_startup (phy); -if (ret) -return ret; -/* start switch */ ksz_read8 (priv->dev,REG_SW_OPERATION , &data8); data8 |=SW_START ;ksz_write8 (priv->dev,REG_SW_OPERATION , data8); -return 0 ; +return phy_startup (phy); }static void ksz_port_disable (struct udevice *dev,int port,struct phy_device *phy)@@ -410,6 +409,7 @@ static void ksz_port_disable(struct udevice *dev, int port, struct phy_device *p }static const struct dsa_ops ksz_dsa_ops = { + .port_probe = ksz_port_probe, .port_enable = ksz_port_enable, .port_disable = ksz_port_disable, }; --
Quoted 2 lines
2.25.1
Quoted 23 lines · Tim Harvey
packet tagging is not used for this driver so we do not need to call
dsa_set_tagging.Signed-off-by Tim Harvey <[email protected]>--- drivers/net/ksz9477.c | 2 -- 1 file changed, 2 deletions(-)drivers/net/ksz9477.c +0
-3@@ -501,8 +501,6 @@ static int ksz_i2c_probe(struct udevice *dev)ksz_pwrite8 (priv->dev, i,REG_PORT_MSTP_STATE , data8); } -dsa_set_tagging (dev,0 ,0 ); -return 0 ; }; --
Quoted 2 lines
2.25.1
Quoted 5 lines · Tim Harvey
packet tagging is not used for this driver so we do not need to call
dsa_set_tagging.Signed-off-by Tim Harvey <[email protected]>Reviewed-by Ramon Fried <[email protected]>
For the series, applied to u-boot/master, thanks!
Signature · 1 line
Tom