Index: ahci_fdt.c =================================================================== RCS file: /cvs/src/sys/dev/fdt/ahci_fdt.c,v retrieving revision 1.7 diff -u -p -r1.7 ahci_fdt.c --- ahci_fdt.c 25 May 2022 03:03:58 -0000 1.7 +++ ahci_fdt.c 6 Apr 2023 21:30:31 -0000 @@ -30,6 +30,8 @@ #include #include +#include +#include #include int ahci_fdt_match(struct device *, void *, void *); @@ -63,6 +65,7 @@ ahci_fdt_attach(struct device *parent, s { struct ahci_softc *sc = (struct ahci_softc *) self; struct fdt_attach_args *faa = aux; + uint32_t pi; if (faa->fa_nreg < 1) return; @@ -82,11 +85,19 @@ ahci_fdt_attach(struct device *parent, s goto unmap; } + clock_set_assigned(faa->fa_node); + clock_enable_all(faa->fa_node); + phy_enable(faa->fa_node, "sata-phy"); + + pi = OF_getpropint(faa->fa_node, "ports-implemented", 0x0); + if (pi != 0) + bus_space_write_4(sc->sc_iot, sc->sc_ioh, AHCI_REG_PI, pi); + printf(":"); if (ahci_attach(sc) != 0) { /* error printed by ahci_attach */ - goto irq; + goto irq; /* disable phy and clocks? */ } return;