mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
Merge branch 'stmmac-errors'
Andrew Halaney says: ==================== net: stmmac: dwmac-qcom-ethqos: Improve error handling This series includes some very minor quality of life patches in the error handling. I recently ran into a few issues where these patches would have made my life easier (messing with the devicetree, dependent driver of this failing, and incorrect kernel configs resulting in this driver not probing). v1: https://lore.kernel.org/netdev/20230629191725.1434142-1-ahalaney@redhat.com/ Changes since v1: * Collect tags (Andrew Lunn) * Switch to of_get_phy_mode() (Andrew Lunn) * Follow netdev patch submission process (net-next subject, wait until merge window is open) (Simon) ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
e0f0a5db5f
1 changed files with 17 additions and 11 deletions
|
@ -4,10 +4,10 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_net.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/phy.h>
|
||||
#include <linux/phy/phy.h>
|
||||
#include <linux/property.h>
|
||||
|
||||
#include "stmmac.h"
|
||||
#include "stmmac_platform.h"
|
||||
|
@ -104,7 +104,7 @@ struct qcom_ethqos {
|
|||
struct clk *link_clk;
|
||||
struct phy *serdes_phy;
|
||||
unsigned int speed;
|
||||
int phy_mode;
|
||||
phy_interface_t phy_mode;
|
||||
|
||||
const struct ethqos_emac_por *por;
|
||||
unsigned int num_por;
|
||||
|
@ -706,12 +706,13 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
|
|||
|
||||
ret = stmmac_get_platform_resources(pdev, &stmmac_res);
|
||||
if (ret)
|
||||
return ret;
|
||||
return dev_err_probe(dev, ret,
|
||||
"Failed to get platform resources\n");
|
||||
|
||||
plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac);
|
||||
if (IS_ERR(plat_dat)) {
|
||||
dev_err(dev, "dt configuration failed\n");
|
||||
return PTR_ERR(plat_dat);
|
||||
return dev_err_probe(dev, PTR_ERR(plat_dat),
|
||||
"dt configuration failed\n");
|
||||
}
|
||||
|
||||
plat_dat->clks_config = ethqos_clks_config;
|
||||
|
@ -720,7 +721,9 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
|
|||
if (!ethqos)
|
||||
return -ENOMEM;
|
||||
|
||||
ethqos->phy_mode = device_get_phy_mode(dev);
|
||||
ret = of_get_phy_mode(np, ðqos->phy_mode);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "Failed to get phy mode\n");
|
||||
switch (ethqos->phy_mode) {
|
||||
case PHY_INTERFACE_MODE_RGMII:
|
||||
case PHY_INTERFACE_MODE_RGMII_ID:
|
||||
|
@ -731,16 +734,17 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
|
|||
case PHY_INTERFACE_MODE_SGMII:
|
||||
ethqos->configure_func = ethqos_configure_sgmii;
|
||||
break;
|
||||
case -ENODEV:
|
||||
return -ENODEV;
|
||||
default:
|
||||
dev_err(dev, "Unsupported phy mode %s\n",
|
||||
phy_modes(ethqos->phy_mode));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ethqos->pdev = pdev;
|
||||
ethqos->rgmii_base = devm_platform_ioremap_resource_byname(pdev, "rgmii");
|
||||
if (IS_ERR(ethqos->rgmii_base))
|
||||
return PTR_ERR(ethqos->rgmii_base);
|
||||
return dev_err_probe(dev, PTR_ERR(ethqos->rgmii_base),
|
||||
"Failed to map rgmii resource\n");
|
||||
|
||||
ethqos->mac_base = stmmac_res.addr;
|
||||
|
||||
|
@ -752,7 +756,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
|
|||
|
||||
ethqos->link_clk = devm_clk_get(dev, data->link_clk_name ?: "rgmii");
|
||||
if (IS_ERR(ethqos->link_clk))
|
||||
return PTR_ERR(ethqos->link_clk);
|
||||
return dev_err_probe(dev, PTR_ERR(ethqos->link_clk),
|
||||
"Failed to get link_clk\n");
|
||||
|
||||
ret = ethqos_clks_config(ethqos, true);
|
||||
if (ret)
|
||||
|
@ -764,7 +769,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
|
|||
|
||||
ethqos->serdes_phy = devm_phy_optional_get(dev, "serdes");
|
||||
if (IS_ERR(ethqos->serdes_phy))
|
||||
return PTR_ERR(ethqos->serdes_phy);
|
||||
return dev_err_probe(dev, PTR_ERR(ethqos->serdes_phy),
|
||||
"Failed to get serdes phy\n");
|
||||
|
||||
ethqos->speed = SPEED_1000;
|
||||
ethqos_update_link_clk(ethqos, SPEED_1000);
|
||||
|
|
Loading…
Add table
Reference in a new issue