Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+43
+43
drivers/phy/qualcomm/phy-qcom-sgmii-eth.c
··· 7 7 #include <linux/ethtool.h> 8 8 #include <linux/module.h> 9 9 #include <linux/of.h> 10 + #include <linux/phy.h> 10 11 #include <linux/phy/phy.h> 11 12 #include <linux/platform_device.h> 12 13 #include <linux/regmap.h> ··· 287 286 return 0; 288 287 } 289 288 289 + static int qcom_dwmac_sgmii_phy_speed(enum phy_mode mode, int submode) 290 + { 291 + if (mode != PHY_MODE_ETHERNET) 292 + return -EINVAL; 293 + 294 + if (submode == PHY_INTERFACE_MODE_SGMII || 295 + submode == PHY_INTERFACE_MODE_1000BASEX) 296 + return SPEED_1000; 297 + 298 + if (submode == PHY_INTERFACE_MODE_2500BASEX) 299 + return SPEED_2500; 300 + 301 + return -EINVAL; 302 + } 303 + 304 + static int qcom_dwmac_sgmii_phy_set_mode(struct phy *phy, enum phy_mode mode, 305 + int submode) 306 + { 307 + struct qcom_dwmac_sgmii_phy_data *data = phy_get_drvdata(phy); 308 + int speed; 309 + 310 + speed = qcom_dwmac_sgmii_phy_speed(mode, submode); 311 + if (speed < 0) 312 + return speed; 313 + 314 + if (speed != data->speed) 315 + data->speed = speed; 316 + 317 + return qcom_dwmac_sgmii_phy_calibrate(phy); 318 + } 319 + 290 320 static int qcom_dwmac_sgmii_phy_set_speed(struct phy *phy, int speed) 291 321 { 292 322 struct qcom_dwmac_sgmii_phy_data *data = phy_get_drvdata(phy); ··· 328 296 return qcom_dwmac_sgmii_phy_calibrate(phy); 329 297 } 330 298 299 + static int qcom_dwmac_sgmii_phy_validate(struct phy *phy, enum phy_mode mode, 300 + int submode, 301 + union phy_configure_opts *opts) 302 + { 303 + int ret = qcom_dwmac_sgmii_phy_speed(mode, submode); 304 + 305 + return ret < 0 ? ret : 0; 306 + } 307 + 331 308 static const struct phy_ops qcom_dwmac_sgmii_phy_ops = { 332 309 .power_on = qcom_dwmac_sgmii_phy_power_on, 333 310 .power_off = qcom_dwmac_sgmii_phy_power_off, 311 + .set_mode = qcom_dwmac_sgmii_phy_set_mode, 334 312 .set_speed = qcom_dwmac_sgmii_phy_set_speed, 313 + .validate = qcom_dwmac_sgmii_phy_validate, 335 314 .calibrate = qcom_dwmac_sgmii_phy_calibrate, 336 315 .owner = THIS_MODULE, 337 316 };