aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
diff options
context:
space:
mode:
authorVladimir Ermakov <vooon341@gmail.com>2012-03-17 09:10:50 -0400
committerDavid S. Miller <davem@davemloft.net>2012-03-19 18:02:05 -0400
commitba568335b089e0a27829e3a6117a7e1bf957ad07 (patch)
tree460d6569c4ad623ec8f1aee8d0fcb571b3ac1b4d /drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
parentdc72d99dabb870ca5bd6d9fff674be853bb4a88d (diff)
fs_enet: Add MPC5125 FEC support and PHY interface selection
Add compatible string for MPC5125 FEC. The FEC on MPC5125 additionally supports RMII PHY interface. Configure controller/PHY interface type according to the optional phy-connection-type property in the ethernet node. This property should be either "rmii" or "mii". Signed-off-by: Vladimir Ermakov <vooon341@gmail.com> Signed-off-by: Anatolij Gustschin <agust@denx.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c')
-rw-r--r--drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
index 999638a7c851..e4e6cd2c5f82 100644
--- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
+++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
@@ -790,16 +790,20 @@ static int fs_init_phy(struct net_device *dev)
790{ 790{
791 struct fs_enet_private *fep = netdev_priv(dev); 791 struct fs_enet_private *fep = netdev_priv(dev);
792 struct phy_device *phydev; 792 struct phy_device *phydev;
793 phy_interface_t iface;
793 794
794 fep->oldlink = 0; 795 fep->oldlink = 0;
795 fep->oldspeed = 0; 796 fep->oldspeed = 0;
796 fep->oldduplex = -1; 797 fep->oldduplex = -1;
797 798
799 iface = fep->fpi->use_rmii ?
800 PHY_INTERFACE_MODE_RMII : PHY_INTERFACE_MODE_MII;
801
798 phydev = of_phy_connect(dev, fep->fpi->phy_node, &fs_adjust_link, 0, 802 phydev = of_phy_connect(dev, fep->fpi->phy_node, &fs_adjust_link, 0,
799 PHY_INTERFACE_MODE_MII); 803 iface);
800 if (!phydev) { 804 if (!phydev) {
801 phydev = of_phy_connect_fixed_link(dev, &fs_adjust_link, 805 phydev = of_phy_connect_fixed_link(dev, &fs_adjust_link,
802 PHY_INTERFACE_MODE_MII); 806 iface);
803 } 807 }
804 if (!phydev) { 808 if (!phydev) {
805 dev_err(&dev->dev, "Could not attach to PHY\n"); 809 dev_err(&dev->dev, "Could not attach to PHY\n");
@@ -1007,6 +1011,7 @@ static int __devinit fs_enet_probe(struct platform_device *ofdev)
1007 struct fs_platform_info *fpi; 1011 struct fs_platform_info *fpi;
1008 const u32 *data; 1012 const u32 *data;
1009 const u8 *mac_addr; 1013 const u8 *mac_addr;
1014 const char *phy_connection_type;
1010 int privsize, len, ret = -ENODEV; 1015 int privsize, len, ret = -ENODEV;
1011 1016
1012 match = of_match_device(fs_enet_match, &ofdev->dev); 1017 match = of_match_device(fs_enet_match, &ofdev->dev);
@@ -1035,6 +1040,13 @@ static int __devinit fs_enet_probe(struct platform_device *ofdev)
1035 NULL))) 1040 NULL)))
1036 goto out_free_fpi; 1041 goto out_free_fpi;
1037 1042
1043 if (of_device_is_compatible(ofdev->dev.of_node, "fsl,mpc5125-fec")) {
1044 phy_connection_type = of_get_property(ofdev->dev.of_node,
1045 "phy-connection-type", NULL);
1046 if (phy_connection_type && !strcmp("rmii", phy_connection_type))
1047 fpi->use_rmii = 1;
1048 }
1049
1038 privsize = sizeof(*fep) + 1050 privsize = sizeof(*fep) +
1039 sizeof(struct sk_buff **) * 1051 sizeof(struct sk_buff **) *
1040 (fpi->rx_ring + fpi->tx_ring); 1052 (fpi->rx_ring + fpi->tx_ring);
@@ -1150,6 +1162,10 @@ static struct of_device_id fs_enet_match[] = {
1150 .compatible = "fsl,mpc5121-fec", 1162 .compatible = "fsl,mpc5121-fec",
1151 .data = (void *)&fs_fec_ops, 1163 .data = (void *)&fs_fec_ops,
1152 }, 1164 },
1165 {
1166 .compatible = "fsl,mpc5125-fec",
1167 .data = (void *)&fs_fec_ops,
1168 },
1153#else 1169#else
1154 { 1170 {
1155 .compatible = "fsl,pq1-fec-enet", 1171 .compatible = "fsl,pq1-fec-enet",