mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 20:46:48 +02:00
net: stmmac: qcom-ethqos: further serdes reorganisation [part]
First PHY patch of Russell's series. Vladimir will need this to avoid a conflict with his work. Link: https://patch.msgid.link/aaDSJAc-x2-klvHJ@shell.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org> -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6jPA+I1ugmIBA4hXMUZtbf5SIrsFAmmmISIACgkQMUZtbf5S Iru8xA//RBLScdR3NJdPyo7cbCHJCtPksc7bzF5KXDFk6pcVXWLsruOAk/KanXIl uRJbV4bCNP0jEo09GZT/jIPqtZXaKeRWkzFt1dG380jSQPzQ9BEdfQcQmBrGAO9J 8hh/48YUMfYbyw+uyODeDItK2Oz0c7ARAjyjec7SlzBILm7ILxi6WwQ+y+3p5VR2 +hetCjt1a5bcn+JH0RZNgoJl3vyWeVzdSawbEjs7I77hWBTHe/sB83Y8ISZl4/Ac Y+gkFfWZ54Yc4g2J+z4LWCmxYFp0fxEY1Ea5xcWEbF3hfixvBMpzl8yDjcYf4Hdh nigUZXdJ2Fifs/T0GMc1juStdy6xOun/fl1jv9vko3aPfwNAIzyzVBUcVj76Ce1w MvG7cmPy7ZkWlCaxm8k5moJuxliD453NFzXJV3INdoFoQaRMbne58CHvl0H20kcG xR8/ERTNP9Q6NQfp1lVm0CEtasw6Cg9vq5n7w8fbMH8FWibMPn7a/nCOMWfrf+Le USOhha5J7TFCEXfE1FCg+8dbP8V9lav0YJt8wxlcDeEVLGJim5qtGTcmjJIN0lVf 9Adk5KEAlwAUUhGlW145VXFPtzgT1vjVXx7fK9EOKcp8Cy+SO6hSLXTQg/RlRKXz MLJrRkrFLy5tfUN19KRofOu9+l6CVjbp/fv03BIE7SmUMkT1YuM= =FZuS -----END PGP SIGNATURE----- Merge tag 'phy-qcom-sgmii-eth-add-set_mode-and-validate-methods' net: stmmac: qcom-ethqos: further serdes reorganisation [part] First PHY patch of Russell's series. Vladimir will need this to avoid a conflict with his work. Link: https://patch.msgid.link/aaDSJAc-x2-klvHJ@shell.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
f5ada26d6c
|
|
@ -7,6 +7,7 @@
|
|||
#include <linux/ethtool.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/phy.h>
|
||||
#include <linux/phy/phy.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/regmap.h>
|
||||
|
|
@ -286,6 +287,37 @@ static int qcom_dwmac_sgmii_phy_power_off(struct phy *phy)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int qcom_dwmac_sgmii_phy_speed(enum phy_mode mode, int submode)
|
||||
{
|
||||
if (mode != PHY_MODE_ETHERNET)
|
||||
return -EINVAL;
|
||||
|
||||
if (submode == PHY_INTERFACE_MODE_SGMII ||
|
||||
submode == PHY_INTERFACE_MODE_1000BASEX)
|
||||
return SPEED_1000;
|
||||
|
||||
if (submode == PHY_INTERFACE_MODE_2500BASEX)
|
||||
return SPEED_2500;
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int qcom_dwmac_sgmii_phy_set_mode(struct phy *phy, enum phy_mode mode,
|
||||
int submode)
|
||||
{
|
||||
struct qcom_dwmac_sgmii_phy_data *data = phy_get_drvdata(phy);
|
||||
int speed;
|
||||
|
||||
speed = qcom_dwmac_sgmii_phy_speed(mode, submode);
|
||||
if (speed < 0)
|
||||
return speed;
|
||||
|
||||
if (speed != data->speed)
|
||||
data->speed = speed;
|
||||
|
||||
return qcom_dwmac_sgmii_phy_calibrate(phy);
|
||||
}
|
||||
|
||||
static int qcom_dwmac_sgmii_phy_set_speed(struct phy *phy, int speed)
|
||||
{
|
||||
struct qcom_dwmac_sgmii_phy_data *data = phy_get_drvdata(phy);
|
||||
|
|
@ -296,10 +328,21 @@ static int qcom_dwmac_sgmii_phy_set_speed(struct phy *phy, int speed)
|
|||
return qcom_dwmac_sgmii_phy_calibrate(phy);
|
||||
}
|
||||
|
||||
static int qcom_dwmac_sgmii_phy_validate(struct phy *phy, enum phy_mode mode,
|
||||
int submode,
|
||||
union phy_configure_opts *opts)
|
||||
{
|
||||
int ret = qcom_dwmac_sgmii_phy_speed(mode, submode);
|
||||
|
||||
return ret < 0 ? ret : 0;
|
||||
}
|
||||
|
||||
static const struct phy_ops qcom_dwmac_sgmii_phy_ops = {
|
||||
.power_on = qcom_dwmac_sgmii_phy_power_on,
|
||||
.power_off = qcom_dwmac_sgmii_phy_power_off,
|
||||
.set_mode = qcom_dwmac_sgmii_phy_set_mode,
|
||||
.set_speed = qcom_dwmac_sgmii_phy_set_speed,
|
||||
.validate = qcom_dwmac_sgmii_phy_validate,
|
||||
.calibrate = qcom_dwmac_sgmii_phy_calibrate,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user