Changes since v1:
* Add one patch to use devm_gpio_request_one
* Have a separate patch to fix phy-reset-gpios property in binding
document
* Change phy-reset-interval to phy-reset-duration
* Add a sanity check on phy-reset-duration value
Shawn Guo (5):
net: fec: reset phy after pinctrl setup
net: fec: enable regulator for fec phy
net: fec: use managed function devm_gpio_request_one
net: fec: phy-reset-gpios is optional
net: fec: add phy-reset-duration for device tree probe
Documentation/devicetree/bindings/net/fsl-fec.txt | 6 +++-
drivers/net/ethernet/freescale/fec.c | 28 ++++++++++++++++++---
2 files changed, 29 insertions(+), 5 deletions(-)
--
1.7.5.4
In case that bootloader or platform initialization does not set up
fec pins, the fec_reset_phy will not be able to succeed, because
fec_reset_phy is currently called before devm_pinctrl_get_select_default.
Move fec_reset_phy call to the place between devm_pinctrl_get_select_default
and fec_enet_init to have above case be taken care.
Signed-off-by: Shawn Guo <redacted>
---
drivers/net/ethernet/freescale/fec.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
If bootloader or platform initialization code does not enable the
power supply to fec phy, we need to do it in fec driver before calling
fec_reset_phy to have the phy powered on.
Signed-off-by: Shawn Guo <redacted>
---
drivers/net/ethernet/freescale/fec.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
Using gpio_request_one will require the probe fail-out call gpio_free,
which is missing currently. Change to use devm_gpio_request_one to
fix the problem.
Signed-off-by: Shawn Guo <redacted>
---
drivers/net/ethernet/freescale/fec.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
The phy-reset-gpios is an optional property for fec device tree boot.
Change the binding document to match the driver code.
Signed-off-by: Shawn Guo <redacted>
---
Documentation/devicetree/bindings/net/fsl-fec.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
Different boards may require different phy reset duration. Add property
phy-reset-duration for device tree probe, so that the boards that need
a longer reset duration can specify it in their device tree.
Signed-off-by: Shawn Guo <redacted>
---
Documentation/devicetree/bindings/net/fsl-fec.txt | 4 ++++
drivers/net/ethernet/freescale/fec.c | 8 +++++++-
2 files changed, 11 insertions(+), 1 deletions(-)
@@ -11,6 +11,10 @@ Required properties: Optional properties: - local-mac-address : 6 bytes, mac address - phy-reset-gpios : Should specify the gpio for phy reset+- phy-reset-duration : Reset duration in milliseconds. Should present+ only if property "phy-reset-gpios" is available. Missing the property+ will have the duration be 1 millisecond. Numbers greater than 1000 are+ invalid and 1 millisecond will be used instead. Example:
@@ -1507,11 +1507,17 @@ static int __devinit fec_get_phy_mode_dt(struct platform_device *pdev)staticvoid__devinitfec_reset_phy(structplatform_device*pdev){interr,phy_reset;+intmsec=1;structdevice_node*np=pdev->dev.of_node;if(!np)return;+of_property_read_u32(np,"phy-reset-duration",&msec);+/* A sane reset duration should not be longer than 1s */+if(msec>1000)+msec=1;+phy_reset=of_get_named_gpio(np,"phy-reset-gpios",0);err=devm_gpio_request_one(&pdev->dev,phy_reset,GPIOF_OUT_INIT_LOW,"phy-reset");
@@ -1519,7 +1525,7 @@ static void __devinit fec_reset_phy(struct platform_device *pdev)pr_debug("FEC: failed to get gpio phy-reset: %d\n",err);return;}-msleep(1);+msleep(msec);gpio_set_value(phy_reset,1);}#else /* CONFIG_OF */
Changes since v1:
* Add one patch to use devm_gpio_request_one
* Have a separate patch to fix phy-reset-gpios property in binding
document
* Change phy-reset-interval to phy-reset-duration
* Add a sanity check on phy-reset-duration value