summaryrefslogtreecommitdiff
path: root/sys/arch/armv7/imx
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2016-07-23 14:39:11 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2016-07-23 14:39:11 +0000
commitd140ec0d7e20c6ab96573e04d6f5d69d9897b935 (patch)
tree267d2421d2c0ed50dfe0ab3fd6bcb355b8dfffa1 /sys/arch/armv7/imx
parent4e427737398c9a4eae6e8784e306e4d39c44a293 (diff)
The linux kernel treated the "phy-reset-gpio" as active-low regardless of what
the device tree says. As a result many device trees encode it as active-high when active-low is needed. For now just override the device tree. ok jsg@, patrick@
Diffstat (limited to 'sys/arch/armv7/imx')
-rw-r--r--sys/arch/armv7/imx/if_fec.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sys/arch/armv7/imx/if_fec.c b/sys/arch/armv7/imx/if_fec.c
index d9ef8a591d2..0ba9c0cc6fd 100644
--- a/sys/arch/armv7/imx/if_fec.c
+++ b/sys/arch/armv7/imx/if_fec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_fec.c,v 1.9 2016/07/22 13:20:30 jsg Exp $ */
+/* $OpenBSD: if_fec.c,v 1.10 2016/07/23 14:39:10 kettenis Exp $ */
/*
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
*
@@ -326,10 +326,20 @@ fec_attach(struct device *parent, struct device *self, void *aux)
if (phy_reset_duration > 1000)
phy_reset_duration = 1;
+ /*
+ * The Linux people really screwed the pooch here.
+ * The Linux kernel always treats the gpio as
+ * active-low, even if it is marked as active-high in
+ * the device tree. As a result the device tree for
+ * many boards incorrectly marks the gpio as
+ * active-high.
+ */
+ phy_reset_gpio[2] = GPIO_ACTIVE_LOW;
+
gpio_controller_config_pin(phy_reset_gpio, GPIO_CONFIG_OUTPUT);
- gpio_controller_set_pin(phy_reset_gpio, 0);
- delay(phy_reset_duration * 1000);
gpio_controller_set_pin(phy_reset_gpio, 1);
+ delay(phy_reset_duration * 1000);
+ gpio_controller_set_pin(phy_reset_gpio, 0);
delay(1000);
}
printf("\n");