aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ucc_geth.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ucc_geth.c')
-rw-r--r--drivers/net/ucc_geth.c53
1 files changed, 30 insertions, 23 deletions
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 8cc316653a39..0ee4c168e4c0 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3833,6 +3833,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3833 struct device_node *phy; 3833 struct device_node *phy;
3834 int err, ucc_num, max_speed = 0; 3834 int err, ucc_num, max_speed = 0;
3835 const phandle *ph; 3835 const phandle *ph;
3836 const u32 *fixed_link;
3836 const unsigned int *prop; 3837 const unsigned int *prop;
3837 const char *sprop; 3838 const char *sprop;
3838 const void *mac_addr; 3839 const void *mac_addr;
@@ -3923,18 +3924,38 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3923 3924
3924 ug_info->uf_info.regs = res.start; 3925 ug_info->uf_info.regs = res.start;
3925 ug_info->uf_info.irq = irq_of_parse_and_map(np, 0); 3926 ug_info->uf_info.irq = irq_of_parse_and_map(np, 0);
3927 fixed_link = of_get_property(np, "fixed-link", NULL);
3928 if (fixed_link) {
3929 ug_info->mdio_bus = 0;
3930 ug_info->phy_address = fixed_link[0];
3931 phy = NULL;
3932 } else {
3933 ph = of_get_property(np, "phy-handle", NULL);
3934 phy = of_find_node_by_phandle(*ph);
3926 3935
3927 ph = of_get_property(np, "phy-handle", NULL); 3936 if (phy == NULL)
3928 phy = of_find_node_by_phandle(*ph); 3937 return -ENODEV;
3929 3938
3930 if (phy == NULL) 3939 /* set the PHY address */
3931 return -ENODEV; 3940 prop = of_get_property(phy, "reg", NULL);
3941 if (prop == NULL)
3942 return -1;
3943 ug_info->phy_address = *prop;
3944
3945 /* Set the bus id */
3946 mdio = of_get_parent(phy);
3947
3948 if (mdio == NULL)
3949 return -1;
3932 3950
3933 /* set the PHY address */ 3951 err = of_address_to_resource(mdio, 0, &res);
3934 prop = of_get_property(phy, "reg", NULL); 3952 of_node_put(mdio);
3935 if (prop == NULL) 3953
3936 return -1; 3954 if (err)
3937 ug_info->phy_address = *prop; 3955 return -1;
3956
3957 ug_info->mdio_bus = res.start;
3958 }
3938 3959
3939 /* get the phy interface type, or default to MII */ 3960 /* get the phy interface type, or default to MII */
3940 prop = of_get_property(np, "phy-connection-type", NULL); 3961 prop = of_get_property(np, "phy-connection-type", NULL);
@@ -3979,20 +4000,6 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3979 ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_4; 4000 ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_4;
3980 } 4001 }
3981 4002
3982 /* Set the bus id */
3983 mdio = of_get_parent(phy);
3984
3985 if (mdio == NULL)
3986 return -1;
3987
3988 err = of_address_to_resource(mdio, 0, &res);
3989 of_node_put(mdio);
3990
3991 if (err)
3992 return -1;
3993
3994 ug_info->mdio_bus = res.start;
3995
3996 if (netif_msg_probe(&debug)) 4003 if (netif_msg_probe(&debug))
3997 printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n", 4004 printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n",
3998 ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs, 4005 ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs,