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 Remove fdtbus_gpio_release() from enet_phy_...



details:   https://anonhg.NetBSD.org/src/rev/ade5d83b5e35
branches:  trunk
changeset: 458094:ade5d83b5e35
user:      hkenken <hkenken%NetBSD.org@localhost>
date:      Tue Jul 30 06:26:31 2019 +0000

description:
Remove fdtbus_gpio_release() from enet_phy_reset().

diffstat:

 sys/arch/arm/imx/fdt/files.imx6    |   6 +++---
 sys/arch/arm/imx/fdt/if_enet_imx.c |  33 ++++++++++++++++++++-------------
 sys/arch/arm/imx/if_enet.c         |   7 ++-----
 sys/arch/arm/imx/if_enet_imx6.c    |   7 +++++--
 sys/arch/arm/imx/if_enet_imx7.c    |   7 +++++--
 5 files changed, 35 insertions(+), 25 deletions(-)

diffs (195 lines):

diff -r 2d697fdafead -r ade5d83b5e35 sys/arch/arm/imx/fdt/files.imx6
--- a/sys/arch/arm/imx/fdt/files.imx6   Tue Jul 30 04:42:29 2019 +0000
+++ b/sys/arch/arm/imx/fdt/files.imx6   Tue Jul 30 06:26:31 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.imx6,v 1.2 2019/07/27 08:02:04 skrll Exp $
+#      $NetBSD: files.imx6,v 1.3 2019/07/30 06:26:31 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -48,9 +48,9 @@
 
 # FEC
 device enet: ether, ifnet, arp, mii, bus_dma_generic
-attach enet at fdt
+attach enet at fdt with enet_fdt
 file   arch/arm/imx/if_enet.c          enet
-file   arch/arm/imx/fdt/if_enet_imx.c  enet
+file   arch/arm/imx/fdt/if_enet_imx.c  enet_fdt
 
 # SATA
 attach ahcisata at fdt with imx6_ahcisata
diff -r 2d697fdafead -r ade5d83b5e35 sys/arch/arm/imx/fdt/if_enet_imx.c
--- a/sys/arch/arm/imx/fdt/if_enet_imx.c        Tue Jul 30 04:42:29 2019 +0000
+++ b/sys/arch/arm/imx/fdt/if_enet_imx.c        Tue Jul 30 06:26:31 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_enet_imx.c,v 1.1 2019/07/24 13:12:33 hkenken Exp $  */
+/*     $NetBSD: if_enet_imx.c,v 1.2 2019/07/30 06:26:31 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.1 2019/07/24 13:12:33 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet_imx.c,v 1.2 2019/07/30 06:26:31 hkenken Exp $");
 
 #include "opt_fdt.h"
 
@@ -40,13 +40,22 @@
 
 #include <dev/fdt/fdtvar.h>
 
+struct enet_fdt_softc {
+       struct enet_softc sc_enet;
+
+       struct fdtbus_gpio_pin *sc_pin_reset;
+};
+
+CFATTACH_DECL_NEW(enet_fdt, sizeof(struct enet_fdt_softc),
+    enet_match, enet_attach, NULL, NULL);
+
 static const char * const compatible[] = {
        "fsl,imx6q-fec",
        NULL
 };
 
 static int enet_init_clocks(struct enet_softc *);
-static void enet_phy_reset(const int);
+static void enet_phy_reset(struct enet_fdt_softc *, const int);
 
 int
 enet_match(device_t parent, cfdata_t cf, void *aux)
@@ -59,7 +68,8 @@
 void
 enet_attach(device_t parent, device_t self, void *aux)
 {
-       struct enet_softc *sc = device_private(self);
+       struct enet_fdt_softc * const efsc = device_private(self);
+       struct enet_softc *sc = &efsc->sc_enet;
        struct fdt_attach_args * const faa = aux;
        const int phandle = faa->faa_phandle;
        bus_space_tag_t bst = faa->faa_bst;
@@ -93,7 +103,7 @@
        aprint_naive("\n");
        aprint_normal(": Gigabit Ethernet Controller\n");
 
-       enet_phy_reset(phandle);
+       enet_phy_reset(efsc, phandle);
 
        sc->sc_dev = self;
        sc->sc_iot = bst;
@@ -150,13 +160,12 @@
 }
 
 static void
-enet_phy_reset(const int phandle)
+enet_phy_reset(struct enet_fdt_softc *sc, const int phandle)
 {
-       struct fdtbus_gpio_pin *reset;
        int error;
 
-       reset = fdtbus_gpio_acquire(phandle, "phy-reset-gpios", GPIO_PIN_OUTPUT);
-       if (reset == NULL)
+       sc->sc_pin_reset = fdtbus_gpio_acquire(phandle, "phy-reset-gpios", GPIO_PIN_OUTPUT);
+       if (sc->sc_pin_reset == NULL)
                return;
 
        u_int msec;
@@ -165,9 +174,7 @@
                msec = 1;
 
        /* Reset */
-       fdtbus_gpio_write(reset, 1);
+       fdtbus_gpio_write(sc->sc_pin_reset, 1);
        delay(msec * 1000);
-       fdtbus_gpio_write(reset, 0);
-
-       fdtbus_gpio_release(reset);
+       fdtbus_gpio_write(sc->sc_pin_reset, 0);
 }
diff -r 2d697fdafead -r ade5d83b5e35 sys/arch/arm/imx/if_enet.c
--- a/sys/arch/arm/imx/if_enet.c        Tue Jul 30 04:42:29 2019 +0000
+++ b/sys/arch/arm/imx/if_enet.c        Tue Jul 30 06:26:31 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_enet.c,v 1.24 2019/07/23 06:36:36 hkenken Exp $     */
+/*     $NetBSD: if_enet.c,v 1.25 2019/07/30 06:26:31 hkenken Exp $     */
 
 /*
  * Copyright (c) 2014 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.24 2019/07/23 06:36:36 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.25 2019/07/30 06:26:31 hkenken Exp $");
 
 #include "vlan.h"
 
@@ -166,9 +166,6 @@
 static int enet_alloc_dma(struct enet_softc *, size_t, void **,
                          bus_dmamap_t *);
 
-CFATTACH_DECL_NEW(enet, sizeof(struct enet_softc),
-    enet_match, enet_attach, NULL, NULL);
-
 int
 enet_attach_common(device_t self)
 {
diff -r 2d697fdafead -r ade5d83b5e35 sys/arch/arm/imx/if_enet_imx6.c
--- a/sys/arch/arm/imx/if_enet_imx6.c   Tue Jul 30 04:42:29 2019 +0000
+++ b/sys/arch/arm/imx/if_enet_imx6.c   Tue Jul 30 06:26:31 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_enet_imx6.c,v 1.5 2019/07/23 06:36:36 hkenken Exp $ */
+/*     $NetBSD: if_enet_imx6.c,v 1.6 2019/07/30 06:26:31 hkenken Exp $ */
 
 /*
  * Copyright (c) 2014 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_enet_imx6.c,v 1.5 2019/07/23 06:36:36 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet_imx6.c,v 1.6 2019/07/30 06:26:31 hkenken Exp $");
 
 #include "locators.h"
 #include "imxccm.h"
@@ -47,6 +47,9 @@
 #include <arm/imx/if_enetreg.h>
 #include <arm/imx/if_enetvar.h>
 
+CFATTACH_DECL_NEW(enet, sizeof(struct enet_softc),
+    enet_match, enet_attach, NULL, NULL);
+
 static int enet_init_clocks(struct enet_softc *);
 
 int
diff -r 2d697fdafead -r ade5d83b5e35 sys/arch/arm/imx/if_enet_imx7.c
--- a/sys/arch/arm/imx/if_enet_imx7.c   Tue Jul 30 04:42:29 2019 +0000
+++ b/sys/arch/arm/imx/if_enet_imx7.c   Tue Jul 30 06:26:31 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_enet_imx7.c,v 1.3 2019/07/23 06:36:36 hkenken Exp $ */
+/*     $NetBSD: if_enet_imx7.c,v 1.4 2019/07/30 06:26:31 hkenken Exp $ */
 
 /*
  * Copyright (c) 2014 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_enet_imx7.c,v 1.3 2019/07/23 06:36:36 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet_imx7.c,v 1.4 2019/07/30 06:26:31 hkenken Exp $");
 
 #include "locators.h"
 #include "imxccm.h"
@@ -46,6 +46,9 @@
 #include <arm/imx/if_enetreg.h>
 #include <arm/imx/if_enetvar.h>
 
+CFATTACH_DECL_NEW(enet, sizeof(struct enet_softc),
+    enet_match, enet_attach, NULL, NULL);
+
 static void get_mac_from_ocotp(struct enet_softc *, device_t self,
     const char *);
 



Home | Main Index | Thread Index | Old Index