Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Oct 2023 17:06:01 GMT
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 7854d0f6584d - main - dwc: Get the mii clock after calling IF_DWC_INIT
Message-ID:  <202310061706.396H615W060709@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=7854d0f6584d259fd7f13595e3d3a4f157db9339

commit 7854d0f6584d259fd7f13595e3d3a4f157db9339
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2023-10-06 15:43:09 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2023-10-06 17:05:40 +0000

    dwc: Get the mii clock after calling IF_DWC_INIT
    
    We need to calculate it based on the clocks and they aren't started
    before IF_DWC_INIT.
---
 sys/dev/dwc/if_dwc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c
index ffcf3e8d6afd..d212c2db131f 100644
--- a/sys/dev/dwc/if_dwc.c
+++ b/sys/dev/dwc/if_dwc.c
@@ -504,7 +504,6 @@ dwc_attach(device_t dev)
 	sc->rx_idx = 0;
 	sc->tx_desccount = TX_DESC_COUNT;
 	sc->tx_mapcount = 0;
-	sc->mii_clk = IF_DWC_MII_CLK(dev);
 
 	sc->node = ofw_bus_get_node(dev);
 	sc->phy_mode = mii_fdt_get_contype(sc->node);
@@ -552,6 +551,11 @@ dwc_attach(device_t dev)
 	if (IF_DWC_INIT(dev) != 0)
 		return (ENXIO);
 
+	if ((sc->mii_clk = IF_DWC_MII_CLK(dev)) < 0) {
+		device_printf(dev, "Cannot get mii clock value %d\n", -sc->mii_clk);
+		return (ENXIO);
+	}
+
 	if (bus_alloc_resources(dev, dwc_spec, sc->res)) {
 		device_printf(dev, "could not allocate resources\n");
 		return (ENXIO);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202310061706.396H615W060709>