diff options
Diffstat (limited to 'drivers/net/ucc_geth.c')
-rw-r--r-- | drivers/net/ucc_geth.c | 55 |
1 files changed, 51 insertions, 4 deletions
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 73d6ac9406b3..4ffd8739f8b7 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -3819,6 +3819,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3819 | int err, ucc_num, max_speed = 0; | 3819 | int err, ucc_num, max_speed = 0; |
3820 | const phandle *ph; | 3820 | const phandle *ph; |
3821 | const unsigned int *prop; | 3821 | const unsigned int *prop; |
3822 | const char *sprop; | ||
3822 | const void *mac_addr; | 3823 | const void *mac_addr; |
3823 | phy_interface_t phy_interface; | 3824 | phy_interface_t phy_interface; |
3824 | static const int enet_to_speed[] = { | 3825 | static const int enet_to_speed[] = { |
@@ -3851,10 +3852,56 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3851 | 3852 | ||
3852 | ug_info->uf_info.ucc_num = ucc_num; | 3853 | ug_info->uf_info.ucc_num = ucc_num; |
3853 | 3854 | ||
3854 | prop = of_get_property(np, "rx-clock", NULL); | 3855 | sprop = of_get_property(np, "rx-clock-name", NULL); |
3855 | ug_info->uf_info.rx_clock = *prop; | 3856 | if (sprop) { |
3856 | prop = of_get_property(np, "tx-clock", NULL); | 3857 | ug_info->uf_info.rx_clock = qe_clock_source(sprop); |
3857 | ug_info->uf_info.tx_clock = *prop; | 3858 | if ((ug_info->uf_info.rx_clock < QE_CLK_NONE) || |
3859 | (ug_info->uf_info.rx_clock > QE_CLK24)) { | ||
3860 | printk(KERN_ERR | ||
3861 | "ucc_geth: invalid rx-clock-name property\n"); | ||
3862 | return -EINVAL; | ||
3863 | } | ||
3864 | } else { | ||
3865 | prop = of_get_property(np, "rx-clock", NULL); | ||
3866 | if (!prop) { | ||
3867 | /* If both rx-clock-name and rx-clock are missing, | ||
3868 | we want to tell people to use rx-clock-name. */ | ||
3869 | printk(KERN_ERR | ||
3870 | "ucc_geth: missing rx-clock-name property\n"); | ||
3871 | return -EINVAL; | ||
3872 | } | ||
3873 | if ((*prop < QE_CLK_NONE) || (*prop > QE_CLK24)) { | ||
3874 | printk(KERN_ERR | ||
3875 | "ucc_geth: invalid rx-clock propperty\n"); | ||
3876 | return -EINVAL; | ||
3877 | } | ||
3878 | ug_info->uf_info.rx_clock = *prop; | ||
3879 | } | ||
3880 | |||
3881 | sprop = of_get_property(np, "tx-clock-name", NULL); | ||
3882 | if (sprop) { | ||
3883 | ug_info->uf_info.tx_clock = qe_clock_source(sprop); | ||
3884 | if ((ug_info->uf_info.tx_clock < QE_CLK_NONE) || | ||
3885 | (ug_info->uf_info.tx_clock > QE_CLK24)) { | ||
3886 | printk(KERN_ERR | ||
3887 | "ucc_geth: invalid tx-clock-name property\n"); | ||
3888 | return -EINVAL; | ||
3889 | } | ||
3890 | } else { | ||
3891 | prop = of_get_property(np, "rx-clock", NULL); | ||
3892 | if (!prop) { | ||
3893 | printk(KERN_ERR | ||
3894 | "ucc_geth: mising tx-clock-name property\n"); | ||
3895 | return -EINVAL; | ||
3896 | } | ||
3897 | if ((*prop < QE_CLK_NONE) || (*prop > QE_CLK24)) { | ||
3898 | printk(KERN_ERR | ||
3899 | "ucc_geth: invalid tx-clock property\n"); | ||
3900 | return -EINVAL; | ||
3901 | } | ||
3902 | ug_info->uf_info.tx_clock = *prop; | ||
3903 | } | ||
3904 | |||
3858 | err = of_address_to_resource(np, 0, &res); | 3905 | err = of_address_to_resource(np, 0, &res); |
3859 | if (err) | 3906 | if (err) |
3860 | return -EINVAL; | 3907 | return -EINVAL; |