From: kettenis Date: Sat, 3 Sep 2022 19:05:52 +0000 (+0000) Subject: Set AP power state. This is needed if U-Boot didn't do this for us. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=64cf32f94cef382475d12c06f1ba386013c374f2;p=openbsd Set AP power state. This is needed if U-Boot didn't do this for us. --- diff --git a/sys/arch/arm64/dev/aplrtk.c b/sys/arch/arm64/dev/aplrtk.c index 3a7f0afeefc..0833b3ffec9 100644 --- a/sys/arch/arm64/dev/aplrtk.c +++ b/sys/arch/arm64/dev/aplrtk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aplrtk.c,v 1.1 2022/08/31 14:47:22 kettenis Exp $ */ +/* $OpenBSD: aplrtk.c,v 1.2 2022/09/03 19:05:52 kettenis Exp $ */ /* * Copyright (c) 2022 Mark Kettenis * @@ -47,7 +47,7 @@ struct aplrtk_softc { uint32_t sc_phandle; struct rtkit sc_rtkit; - struct rtkit_state *sc_rtkit_state; + struct rtkit_state *sc_state; }; int aplrtk_match(struct device *, void *, void *); @@ -98,17 +98,22 @@ int aplrtk_do_start(struct aplrtk_softc *sc) { uint32_t ctrl; + int error; ctrl = HREAD4(sc, CPU_CTRL); HWRITE4(sc, CPU_CTRL, ctrl | CPU_CTRL_RUN); sc->sc_rtkit.rk_cookie = sc; sc->sc_rtkit.rk_dmat = sc->sc_dmat; - sc->sc_rtkit_state = rtkit_init(sc->sc_node, NULL, &sc->sc_rtkit); - if (sc->sc_rtkit_state == NULL) + sc->sc_state = rtkit_init(sc->sc_node, NULL, &sc->sc_rtkit); + if (sc->sc_state == NULL) return EIO; - return rtkit_boot(sc->sc_rtkit_state); + error = rtkit_boot(sc->sc_state); + if (error) + return error; + + return rtkit_set_ap_pwrstate(sc->sc_state, RTKIT_MGMT_PWR_STATE_ON); } int