From: kettenis Date: Tue, 31 Jul 2018 10:08:24 +0000 (+0000) Subject: Correctly set the dividers for the clock of the "big" cores. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2cb496bceec0308fc6d94905f880cabe477ab6a7;p=openbsd Correctly set the dividers for the clock of the "big" cores. --- diff --git a/sys/dev/fdt/rkclock.c b/sys/dev/fdt/rkclock.c index 1d3fcd7e55f..c48683090a3 100644 --- a/sys/dev/fdt/rkclock.c +++ b/sys/dev/fdt/rkclock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rkclock.c,v 1.25 2018/06/02 13:00:25 kettenis Exp $ */ +/* $OpenBSD: rkclock.c,v 1.26 2018/07/31 10:08:24 kettenis Exp $ */ /* * Copyright (c) 2017, 2018 Mark Kettenis * @@ -971,12 +971,12 @@ rk3399_set_armclk(struct rkclock_softc *sc, bus_size_t clksel, uint32_t freq) /* When ramping up, set clock dividers first. */ if (freq > old_freq) { - HWRITE4(sc, RK3399_CRU_CLKSEL_CON(0), + HWRITE4(sc, clksel, RK3399_CRU_CLK_CORE_DIV_CON_MASK << 16 | 0 << RK3399_CRU_CLK_CORE_DIV_CON_SHIFT | RK3399_CRU_ACLKM_CORE_DIV_CON_MASK << 16 | 1 << RK3399_CRU_ACLKM_CORE_DIV_CON_SHIFT); - HWRITE4(sc, RK3399_CRU_CLKSEL_CON(1), + HWRITE4(sc, clksel + 0x0004, RK3399_CRU_PCLK_DBG_DIV_CON_MASK << 16 | div << RK3399_CRU_PCLK_DBG_DIV_CON_SHIFT | RK3399_CRU_ATCLK_CORE_DIV_CON_MASK << 16 | @@ -987,12 +987,12 @@ rk3399_set_armclk(struct rkclock_softc *sc, bus_size_t clksel, uint32_t freq) /* When ramping dowm, set clock dividers last. */ if (freq < old_freq) { - HWRITE4(sc, RK3399_CRU_CLKSEL_CON(0), + HWRITE4(sc, clksel, RK3399_CRU_CLK_CORE_DIV_CON_MASK << 16 | 0 << RK3399_CRU_CLK_CORE_DIV_CON_SHIFT | RK3399_CRU_ACLKM_CORE_DIV_CON_MASK << 16 | 1 << RK3399_CRU_ACLKM_CORE_DIV_CON_SHIFT); - HWRITE4(sc, RK3399_CRU_CLKSEL_CON(1), + HWRITE4(sc, clksel + 0x0004, RK3399_CRU_PCLK_DBG_DIV_CON_MASK << 16 | div << RK3399_CRU_PCLK_DBG_DIV_CON_SHIFT | RK3399_CRU_ATCLK_CORE_DIV_CON_MASK << 16 |