The branch main has been updated by manu:

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

commit 7854d0f6584d259fd7f13595e3d3a4f157db9339
Author:     Emmanuel Vadot <m...@freebsd.org>
AuthorDate: 2023-10-06 15:43:09 +0000
Commit:     Emmanuel Vadot <m...@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);

Reply via email to