From: kettenis Date: Fri, 3 Feb 2023 13:20:21 +0000 (+0000) Subject: Set clock divider instead of relying on the pre-configured value. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=407288f4e6e7fd4190e6e4903b8384e0b8e28e91;p=openbsd Set clock divider instead of relying on the pre-configured value. ok ratchov@ --- diff --git a/sys/arch/arm64/dev/aplmca.c b/sys/arch/arm64/dev/aplmca.c index ab7a1ea9a6b..88cb4358b61 100644 --- a/sys/arch/arm64/dev/aplmca.c +++ b/sys/arch/arm64/dev/aplmca.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aplmca.c,v 1.5 2022/10/28 15:09:45 kn Exp $ */ +/* $OpenBSD: aplmca.c,v 1.6 2023/02/03 13:20:21 kettenis Exp $ */ /* * Copyright (c) 2022 Mark Kettenis * @@ -48,6 +48,9 @@ #define MCA_STATUS(idx) ((idx) * MCA_CL_STRIDE + 0x0000) #define MCA_STATUS_MCLK_EN (1 << 0) +#define MCA_MCLK_CONF(idx) ((idx) * MCA_CL_STRIDE + 0x0004) +#define MCA_MCLK_CONF_DIV_MASK (0xf << 8) +#define MCA_MCLK_CONF_DIV_SHIFT 8 #define MCA_SYNCGEN_STATUS(idx) ((idx) * MCA_CL_STRIDE + 0x0100) #define MCA_SYNCGEN_STATUS_EN (1 << 0) @@ -462,6 +465,8 @@ aplmca_trigger_output(void *cookie, void *start, void *end, int blksize, period = params->channels * 32; HWRITE4(sc, MCA_SYNCGEN_HI_PERIOD(ad->ad_cluster), period - 2); HWRITE4(sc, MCA_SYNCGEN_LO_PERIOD(ad->ad_cluster), 0); + HWRITE4(sc, MCA_MCLK_CONF(ad->ad_cluster), + 1 << MCA_MCLK_CONF_DIV_SHIFT); clock_enable_idx(sc->sc_node, ad->ad_cluster);