diff options
author | Anton Vorontsov <avorontsov@ru.mvista.com> | 2008-01-21 15:49:53 -0500 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2008-02-06 00:19:03 -0500 |
commit | 8353ec7b0d6666c0674ca978379c55234609dae8 (patch) | |
tree | c95f9678b52891c6748ee68b4c8e6f7dd96f3051 /drivers/net/cpmac.c | |
parent | 9ef9dc69d4167276c04590d67ee55de8380bc1ad (diff) |
cpmac: convert to new Fixed PHY infrastructure
This patch converts cpmac to the new Fixed PHY infrastructure, though it
doesn't fix all the problems with that driver. I didn't even bother to
test this patch to compile, because cpmac driver is broken in several ways:
1. This driver won't compile by itself because lack of its header describing
platform data;
2. It assumes that fixed PHYs should be created by the ethernet driver.
It is wrong assumption: fixed PHYs creation is platform code authority,
driver must blindly accept bus_id and phy_id platform data variables
instead.
Also, it seem that that driver doesn't have actual in-tree users, so
nothing to fix further.
The main purpose of that patch is to get rid of the following Kconfig
warning:
scripts/kconfig/conf -s arch/powerpc/Kconfig
drivers/net/Kconfig:1713:warning: 'select' used by config symbol
'CPMAC' refers to undefined symbol 'FIXED_MII_100_FDX'
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'drivers/net/cpmac.c')
-rw-r--r-- | drivers/net/cpmac.c | 55 |
1 files changed, 18 insertions, 37 deletions
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 | ||
848 | static 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 | |||
857 | static int cpmac_open(struct net_device *dev) | 848 | static 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; | |||
996 | static int __devinit cpmac_probe(struct platform_device *pdev) | 987 | static 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 | ||
1088 | phy_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)) { |