aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/Kconfig4
-rw-r--r--drivers/net/cpmac.c55
2 files changed, 19 insertions, 40 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index f234ba3f0404..5cac0914a979 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1738,10 +1738,8 @@ config SC92031
1738 1738
1739config CPMAC 1739config CPMAC
1740 tristate "TI AR7 CPMAC Ethernet support (EXPERIMENTAL)" 1740 tristate "TI AR7 CPMAC Ethernet support (EXPERIMENTAL)"
1741 depends on NET_ETHERNET && EXPERIMENTAL && AR7 1741 depends on NET_ETHERNET && EXPERIMENTAL && AR7 && BROKEN
1742 select PHYLIB 1742 select PHYLIB
1743 select FIXED_PHY
1744 select FIXED_MII_100_FDX
1745 help 1743 help
1746 TI AR7 CPMAC Ethernet support 1744 TI AR7 CPMAC Ethernet support
1747 1745
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index 6ccebb830ff9..c85194f2cd2d 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -845,15 +845,6 @@ static void cpmac_adjust_link(struct net_device *dev)
845 spin_unlock(&priv->lock); 845 spin_unlock(&priv->lock);
846} 846}
847 847
848static int cpmac_link_update(struct net_device *dev,
849 struct fixed_phy_status *status)
850{
851 status->link = 1;
852 status->speed = 100;
853 status->duplex = 1;
854 return 0;
855}
856
857static int cpmac_open(struct net_device *dev) 848static int cpmac_open(struct net_device *dev)
858{ 849{
859 int i, size, res; 850 int i, size, res;
@@ -996,11 +987,11 @@ static int external_switch;
996static int __devinit cpmac_probe(struct platform_device *pdev) 987static int __devinit cpmac_probe(struct platform_device *pdev)
997{ 988{
998 int rc, phy_id, i; 989 int rc, phy_id, i;
990 int mdio_bus_id = cpmac_mii.id;
999 struct resource *mem; 991 struct resource *mem;
1000 struct cpmac_priv *priv; 992 struct cpmac_priv *priv;
1001 struct net_device *dev; 993 struct net_device *dev;
1002 struct plat_cpmac_data *pdata; 994 struct plat_cpmac_data *pdata;
1003 struct fixed_info *fixed_phy;
1004 DECLARE_MAC_BUF(mac); 995 DECLARE_MAC_BUF(mac);
1005 996
1006 pdata = pdev->dev.platform_data; 997 pdata = pdev->dev.platform_data;
@@ -1014,9 +1005,23 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
1014 } 1005 }
1015 1006
1016 if (phy_id == PHY_MAX_ADDR) { 1007 if (phy_id == PHY_MAX_ADDR) {
1017 if (external_switch || dumb_switch) 1008 if (external_switch || dumb_switch) {
1009 struct fixed_phy_status status = {};
1010
1011 mdio_bus_id = 0;
1012
1013 /*
1014 * FIXME: this should be in the platform code!
1015 * Since there is not platform code at all (that is,
1016 * no mainline users of that driver), place it here
1017 * for now.
1018 */
1018 phy_id = 0; 1019 phy_id = 0;
1019 else { 1020 status.link = 1;
1021 status.duplex = 1;
1022 status.speed = 100;
1023 fixed_phy_add(PHY_POLL, phy_id, &status);
1024 } else {
1020 printk(KERN_ERR "cpmac: no PHY present\n"); 1025 printk(KERN_ERR "cpmac: no PHY present\n");
1021 return -ENODEV; 1026 return -ENODEV;
1022 } 1027 }
@@ -1060,32 +1065,8 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
1060 priv->msg_enable = netif_msg_init(debug_level, 0xff); 1065 priv->msg_enable = netif_msg_init(debug_level, 0xff);
1061 memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr)); 1066 memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr));
1062 1067
1063 if (phy_id == 31) { 1068 snprintf(priv->phy_name, BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id);
1064 snprintf(priv->phy_name, BUS_ID_SIZE, PHY_ID_FMT, cpmac_mii.id,
1065 phy_id);
1066 } else {
1067 /* Let's try to get a free fixed phy... */
1068 for (i = 0; i < MAX_PHY_AMNT; i++) {
1069 fixed_phy = fixed_mdio_get_phydev(i);
1070 if (!fixed_phy)
1071 continue;
1072 if (!fixed_phy->phydev->attached_dev) {
1073 strncpy(priv->phy_name,
1074 fixed_phy->phydev->dev.bus_id,
1075 BUS_ID_SIZE);
1076 fixed_mdio_set_link_update(fixed_phy->phydev,
1077 &cpmac_link_update);
1078 goto phy_found;
1079 }
1080 }
1081 if (netif_msg_drv(priv))
1082 printk(KERN_ERR "%s: Could not find fixed PHY\n",
1083 dev->name);
1084 rc = -ENODEV;
1085 goto fail;
1086 }
1087 1069
1088phy_found:
1089 priv->phy = phy_connect(dev, priv->phy_name, &cpmac_adjust_link, 0, 1070 priv->phy = phy_connect(dev, priv->phy_name, &cpmac_adjust_link, 0,
1090 PHY_INTERFACE_MODE_MII); 1071 PHY_INTERFACE_MODE_MII);
1091 if (IS_ERR(priv->phy)) { 1072 if (IS_ERR(priv->phy)) {