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

net: phy: dp83822: Configure RMII mode on DP83825 devices

Like the DP83826, the DP83825 can also be configured as an RMII master or
slave via a control register. The existing function responsible for this
configuration is renamed to a general dp8382x function. The DP83825 only
supports RMII so nothing more needs to be configured.

With this change, the dp83822_driver list is reorganized according to the
device name.

Signed-off-by: Erik Schumacher <erik.schumacher@iris-sensing.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/aa62d081804f44b5af0e8de2372ae6bfe1affd34.camel@iris-sensing.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Erik Schumacher and committed by
Paolo Abeni
9e114ec8 157a4881

+28 -23
+28 -23
drivers/net/phy/dp83822.c
··· 506 506 return dp83822_config_wol(phydev, &dp83822->wol); 507 507 } 508 508 509 - static int dp83826_config_rmii_mode(struct phy_device *phydev) 509 + static int dp8382x_config_rmii_mode(struct phy_device *phydev) 510 510 { 511 511 struct device *dev = &phydev->mdio.dev; 512 512 const char *of_val; ··· 544 544 if (ret) 545 545 return ret; 546 546 547 - ret = dp83826_config_rmii_mode(phydev); 547 + ret = dp8382x_config_rmii_mode(phydev); 548 548 if (ret) 549 549 return ret; 550 550 } else { ··· 585 585 return dp83822_config_wol(phydev, &dp83822->wol); 586 586 } 587 587 588 - static int dp8382x_config_init(struct phy_device *phydev) 588 + static int dp83825_config_init(struct phy_device *phydev) 589 589 { 590 590 struct dp83822_private *dp83822 = phydev->priv; 591 + int ret; 592 + 593 + ret = dp8382x_config_rmii_mode(phydev); 594 + if (ret) 595 + return ret; 591 596 592 597 return dp83822_config_wol(phydev, &dp83822->wol); 593 598 } ··· 787 782 .resume = dp83822_resume, \ 788 783 } 789 784 785 + #define DP83825_PHY_DRIVER(_id, _name) \ 786 + { \ 787 + PHY_ID_MATCH_MODEL(_id), \ 788 + .name = (_name), \ 789 + /* PHY_BASIC_FEATURES */ \ 790 + .probe = dp8382x_probe, \ 791 + .soft_reset = dp83822_phy_reset, \ 792 + .config_init = dp83825_config_init, \ 793 + .get_wol = dp83822_get_wol, \ 794 + .set_wol = dp83822_set_wol, \ 795 + .config_intr = dp83822_config_intr, \ 796 + .handle_interrupt = dp83822_handle_interrupt, \ 797 + .suspend = dp83822_suspend, \ 798 + .resume = dp83822_resume, \ 799 + } 800 + 790 801 #define DP83826_PHY_DRIVER(_id, _name) \ 791 802 { \ 792 803 PHY_ID_MATCH_MODEL(_id), \ ··· 819 798 .resume = dp83822_resume, \ 820 799 } 821 800 822 - #define DP8382X_PHY_DRIVER(_id, _name) \ 823 - { \ 824 - PHY_ID_MATCH_MODEL(_id), \ 825 - .name = (_name), \ 826 - /* PHY_BASIC_FEATURES */ \ 827 - .probe = dp8382x_probe, \ 828 - .soft_reset = dp83822_phy_reset, \ 829 - .config_init = dp8382x_config_init, \ 830 - .get_wol = dp83822_get_wol, \ 831 - .set_wol = dp83822_set_wol, \ 832 - .config_intr = dp83822_config_intr, \ 833 - .handle_interrupt = dp83822_handle_interrupt, \ 834 - .suspend = dp83822_suspend, \ 835 - .resume = dp83822_resume, \ 836 - } 837 - 838 801 static struct phy_driver dp83822_driver[] = { 839 802 DP83822_PHY_DRIVER(DP83822_PHY_ID, "TI DP83822"), 840 - DP8382X_PHY_DRIVER(DP83825I_PHY_ID, "TI DP83825I"), 803 + DP83825_PHY_DRIVER(DP83825I_PHY_ID, "TI DP83825I"), 804 + DP83825_PHY_DRIVER(DP83825S_PHY_ID, "TI DP83825S"), 805 + DP83825_PHY_DRIVER(DP83825CM_PHY_ID, "TI DP83825M"), 806 + DP83825_PHY_DRIVER(DP83825CS_PHY_ID, "TI DP83825CS"), 841 807 DP83826_PHY_DRIVER(DP83826C_PHY_ID, "TI DP83826C"), 842 808 DP83826_PHY_DRIVER(DP83826NC_PHY_ID, "TI DP83826NC"), 843 - DP8382X_PHY_DRIVER(DP83825S_PHY_ID, "TI DP83825S"), 844 - DP8382X_PHY_DRIVER(DP83825CM_PHY_ID, "TI DP83825M"), 845 - DP8382X_PHY_DRIVER(DP83825CS_PHY_ID, "TI DP83825CS"), 846 809 }; 847 810 module_phy_driver(dp83822_driver); 848 811