Skip to content

Commit 64f10f6

Browse files
bwalledavem330
authored andcommitted
net: fec: Add "phy-reset-active-low" property to DT
We need that for a custom hardware that needs the reverse reset sequence. Signed-off-by: Bernhard Walle <bernhard@bwalle.de> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 12d6b91 commit 64f10f6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Documentation/devicetree/bindings/net/fsl-fec.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ Optional properties:
1212
only if property "phy-reset-gpios" is available. Missing the property
1313
will have the duration be 1 millisecond. Numbers greater than 1000 are
1414
invalid and 1 millisecond will be used instead.
15+
- phy-reset-active-low : If present then the reset sequence using the GPIO
16+
specified in the "phy-reset-gpios" property is reversed (H=reset state,
17+
L=operation state).
1518
- phy-supply : regulator that powers the Ethernet PHY.
1619
- phy-handle : phandle to the PHY device connected to this device.
1720
- fixed-link : Assume a fixed link. See fixed-link.txt in the same directory.

drivers/net/ethernet/freescale/fec_main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3191,6 +3191,7 @@ static int fec_enet_init(struct net_device *ndev)
31913191
static void fec_reset_phy(struct platform_device *pdev)
31923192
{
31933193
int err, phy_reset;
3194+
bool active_low = false;
31943195
int msec = 1;
31953196
struct device_node *np = pdev->dev.of_node;
31963197

@@ -3206,14 +3207,17 @@ static void fec_reset_phy(struct platform_device *pdev)
32063207
if (!gpio_is_valid(phy_reset))
32073208
return;
32083209

3210+
active_low = of_property_read_bool(np, "phy-reset-active-low");
3211+
32093212
err = devm_gpio_request_one(&pdev->dev, phy_reset,
3210-
GPIOF_OUT_INIT_LOW, "phy-reset");
3213+
active_low ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW,
3214+
"phy-reset");
32113215
if (err) {
32123216
dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", err);
32133217
return;
32143218
}
32153219
msleep(msec);
3216-
gpio_set_value_cansleep(phy_reset, 1);
3220+
gpio_set_value_cansleep(phy_reset, !active_low);
32173221
}
32183222
#else /* CONFIG_OF */
32193223
static void fec_reset_phy(struct platform_device *pdev)

0 commit comments

Comments
 (0)