Module Name: src Committed By: hkenken Date: Tue Jul 30 06:26:31 UTC 2019
Modified Files: src/sys/arch/arm/imx: if_enet.c if_enet_imx6.c if_enet_imx7.c src/sys/arch/arm/imx/fdt: files.imx6 if_enet_imx.c Log Message: Remove fdtbus_gpio_release() from enet_phy_reset(). To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/imx/if_enet.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/if_enet_imx6.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/if_enet_imx7.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/fdt/files.imx6 cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/if_enet_imx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/arm/imx/if_enet.c diff -u src/sys/arch/arm/imx/if_enet.c:1.24 src/sys/arch/arm/imx/if_enet.c:1.25 --- src/sys/arch/arm/imx/if_enet.c:1.24 Tue Jul 23 06:36:36 2019 +++ src/sys/arch/arm/imx/if_enet.c Tue Jul 30 06:26:31 2019 @@ -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 <r...@nerv.org> @@ -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 void enet_drain_rxbuf(struct enet 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) { Index: src/sys/arch/arm/imx/if_enet_imx6.c diff -u src/sys/arch/arm/imx/if_enet_imx6.c:1.5 src/sys/arch/arm/imx/if_enet_imx6.c:1.6 --- src/sys/arch/arm/imx/if_enet_imx6.c:1.5 Tue Jul 23 06:36:36 2019 +++ src/sys/arch/arm/imx/if_enet_imx6.c Tue Jul 30 06:26:31 2019 @@ -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 <r...@nerv.org> @@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: if_enet_imx6 #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 Index: src/sys/arch/arm/imx/if_enet_imx7.c diff -u src/sys/arch/arm/imx/if_enet_imx7.c:1.3 src/sys/arch/arm/imx/if_enet_imx7.c:1.4 --- src/sys/arch/arm/imx/if_enet_imx7.c:1.3 Tue Jul 23 06:36:36 2019 +++ src/sys/arch/arm/imx/if_enet_imx7.c Tue Jul 30 06:26:31 2019 @@ -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 <r...@nerv.org> @@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: if_enet_imx7 #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 *); Index: src/sys/arch/arm/imx/fdt/files.imx6 diff -u src/sys/arch/arm/imx/fdt/files.imx6:1.2 src/sys/arch/arm/imx/fdt/files.imx6:1.3 --- src/sys/arch/arm/imx/fdt/files.imx6:1.2 Sat Jul 27 08:02:04 2019 +++ src/sys/arch/arm/imx/fdt/files.imx6 Tue Jul 30 06:26:31 2019 @@ -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 @@ defflag opt_imxuart.h IMXUARTCONSOLE # 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 Index: src/sys/arch/arm/imx/fdt/if_enet_imx.c diff -u src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.1 src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.2 --- src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.1 Wed Jul 24 13:12:33 2019 +++ src/sys/arch/arm/imx/fdt/if_enet_imx.c Tue Jul 30 06:26:31 2019 @@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: if_enet_imx. #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 @@ enet_match(device_t parent, cfdata_t cf, 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 @@ enet_attach(device_t parent, device_t se 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 @@ enet_init_clocks(struct enet_softc *sc) } 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 @@ enet_phy_reset(const int phandle) 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); }