diff options
Diffstat (limited to 'drivers/net/ethernet/freescale/fec_main.c')
-rw-r--r-- | drivers/net/ethernet/freescale/fec_main.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 56a563f90b0b..f7c8649fd28f 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -3192,7 +3192,7 @@ static int fec_reset_phy(struct platform_device *pdev) | |||
3192 | { | 3192 | { |
3193 | int err, phy_reset; | 3193 | int err, phy_reset; |
3194 | bool active_high = false; | 3194 | bool active_high = false; |
3195 | int msec = 1; | 3195 | int msec = 1, phy_post_delay = 0; |
3196 | struct device_node *np = pdev->dev.of_node; | 3196 | struct device_node *np = pdev->dev.of_node; |
3197 | 3197 | ||
3198 | if (!np) | 3198 | if (!np) |
@@ -3209,6 +3209,11 @@ static int fec_reset_phy(struct platform_device *pdev) | |||
3209 | else if (!gpio_is_valid(phy_reset)) | 3209 | else if (!gpio_is_valid(phy_reset)) |
3210 | return 0; | 3210 | return 0; |
3211 | 3211 | ||
3212 | err = of_property_read_u32(np, "phy-reset-post-delay", &phy_post_delay); | ||
3213 | /* valid reset duration should be less than 1s */ | ||
3214 | if (!err && phy_post_delay > 1000) | ||
3215 | return -EINVAL; | ||
3216 | |||
3212 | active_high = of_property_read_bool(np, "phy-reset-active-high"); | 3217 | active_high = of_property_read_bool(np, "phy-reset-active-high"); |
3213 | 3218 | ||
3214 | err = devm_gpio_request_one(&pdev->dev, phy_reset, | 3219 | err = devm_gpio_request_one(&pdev->dev, phy_reset, |
@@ -3226,6 +3231,15 @@ static int fec_reset_phy(struct platform_device *pdev) | |||
3226 | 3231 | ||
3227 | gpio_set_value_cansleep(phy_reset, !active_high); | 3232 | gpio_set_value_cansleep(phy_reset, !active_high); |
3228 | 3233 | ||
3234 | if (!phy_post_delay) | ||
3235 | return 0; | ||
3236 | |||
3237 | if (phy_post_delay > 20) | ||
3238 | msleep(phy_post_delay); | ||
3239 | else | ||
3240 | usleep_range(phy_post_delay * 1000, | ||
3241 | phy_post_delay * 1000 + 1000); | ||
3242 | |||
3229 | return 0; | 3243 | return 0; |
3230 | } | 3244 | } |
3231 | #else /* CONFIG_OF */ | 3245 | #else /* CONFIG_OF */ |