Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: fec: add phy-reset-duration for device tree probe

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 <shawn.guo@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Shawn Guo and committed by
David S. Miller
a3caad0a c9040af2

+11 -1
+4
Documentation/devicetree/bindings/net/fsl-fec.txt
··· 11 11 Optional properties: 12 12 - local-mac-address : 6 bytes, mac address 13 13 - phy-reset-gpios : Should specify the gpio for phy reset 14 + - phy-reset-duration : Reset duration in milliseconds. Should present 15 + only if property "phy-reset-gpios" is available. Missing the property 16 + will have the duration be 1 millisecond. Numbers greater than 1000 are 17 + invalid and 1 millisecond will be used instead. 14 18 15 19 Example: 16 20
+7 -1
drivers/net/ethernet/freescale/fec.c
··· 1507 1507 static void __devinit fec_reset_phy(struct platform_device *pdev) 1508 1508 { 1509 1509 int err, phy_reset; 1510 + int msec = 1; 1510 1511 struct device_node *np = pdev->dev.of_node; 1511 1512 1512 1513 if (!np) 1513 1514 return; 1515 + 1516 + of_property_read_u32(np, "phy-reset-duration", &msec); 1517 + /* A sane reset duration should not be longer than 1s */ 1518 + if (msec > 1000) 1519 + msec = 1; 1514 1520 1515 1521 phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0); 1516 1522 err = devm_gpio_request_one(&pdev->dev, phy_reset, ··· 1525 1519 pr_debug("FEC: failed to get gpio phy-reset: %d\n", err); 1526 1520 return; 1527 1521 } 1528 - msleep(1); 1522 + msleep(msec); 1529 1523 gpio_set_value(phy_reset, 1); 1530 1524 } 1531 1525 #else /* CONFIG_OF */