Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/imx/fdt Add support "phy-reset-post-delay".



details:   https://anonhg.NetBSD.org/src/rev/5fa5d56324de
branches:  trunk
changeset: 846357:5fa5d56324de
user:      hkenken <hkenken%NetBSD.org@localhost>
date:      Wed Nov 13 07:56:10 2019 +0000

description:
Add support "phy-reset-post-delay".

diffstat:

 sys/arch/arm/imx/fdt/if_enet_imx.c |  16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diffs (46 lines):

diff -r 3ce77aadc067 -r 5fa5d56324de sys/arch/arm/imx/fdt/if_enet_imx.c
--- a/sys/arch/arm/imx/fdt/if_enet_imx.c        Wed Nov 13 07:52:25 2019 +0000
+++ b/sys/arch/arm/imx/fdt/if_enet_imx.c        Wed Nov 13 07:56:10 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_enet_imx.c,v 1.6 2019/11/12 08:40:57 hkenken Exp $  */
+/*     $NetBSD: if_enet_imx.c,v 1.7 2019/11/13 07:56:10 hkenken Exp $  */
 /*-
  * Copyright (c) 2019 Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -25,7 +25,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_enet_imx.c,v 1.6 2019/11/12 08:40:57 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet_imx.c,v 1.7 2019/11/13 07:56:10 hkenken Exp $");
 
 #include "opt_fdt.h"
 
@@ -195,19 +195,23 @@
 static void
 enet_phy_reset(struct enet_fdt_softc *sc, const int phandle)
 {
-       int error;
+       u_int msec;
 
        sc->sc_pin_reset = fdtbus_gpio_acquire(phandle, "phy-reset-gpios", GPIO_PIN_OUTPUT);
        if (sc->sc_pin_reset == NULL)
                return;
 
-       u_int msec;
-       error = of_getprop_uint32(phandle, "phy-reset-duration", &msec);
-       if (error)
+       if (of_getprop_uint32(phandle, "phy-reset-duration", &msec))
                msec = 1;
 
        /* Reset */
        fdtbus_gpio_write(sc->sc_pin_reset, 1);
        delay(msec * 1000);
        fdtbus_gpio_write(sc->sc_pin_reset, 0);
+
+       /* Post delay */
+       if (!of_getprop_uint32(phandle, "phy-reset-post-delay", &msec))
+               msec = 0;
+
+       delay(msec * 1000);
 }



Home | Main Index | Thread Index | Old Index