From nobody Fri Nov 13 07:29:49 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jQpmt08XKz7080t for ; Fri, 13 Nov 2026 07:29:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jQpms5rnDz4Zvk for ; Fri, 13 Nov 2026 07:29:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794554989; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AIhIutJ7dpYa7qi0xoFHERm/SyCoY4fopok5CZkBRx4=; b=p+3k26+k9YFiBUakyfHjNHWitUBP5oWDc8sATySrUiQL7L0ySIu/ZcwgeT2a4Sji3YXU2P nsh4T+H89KGaXvXo3AGTn8kQzpo1atr5kvP9Q4cUG+TgKyJJ64AnJ0xn7Aq6prDFSy/jlw MFZ0xZOHzaMGU6UBEq3xAjlY4tRXtfoH32x0YKsdZNn4WFFCZWfIfW1Sn35a06VSSKXC3V SFgQdzZWCoZVEzmIb9EJSJ9fswPHgpPfpuDhmHKJ4xbfv/fYta6ZQEJZYJDSf8Dpyifm6F OIs8VEiI4YuXtfgcClF18kRJLBxa4lVBOb5yPqE0u28rHd4o/cpG2AtqVlBBHQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794554989; b=iKvhM8P2BLZAdk+vKW6AYaIaLxQgnqdQBX4XCqRvYsvw6KZIlPOvf9F7Rc7BhKRRtDc8oN pdJxBqBruprsmm3vtliEXJHg7pGqlyeHpxQbE4u4/oThoFKIt20d+lLKDoWyyShMKZfh0u NS67j7G+EhX0+7ucBjWJgSydL7Dwv89+x5VkLl1Nr4IJ6wIIcGeuCeDISERrKESaiMOjah DQZQw6jVRcE//aazCDjGbnRqjCgldq2PwjjIJpmbFxkyxBNgHW0t0ZlmjE6zIhJCWvaaGd F4ZkeThsbb6t/v9UiIjuz/WFKhPrIx+r0a0bYDApoWtKZ2pqXnKMDRO3PQWZWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794554989; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AIhIutJ7dpYa7qi0xoFHERm/SyCoY4fopok5CZkBRx4=; b=G2ePlWdjnep10F4k2GSaT1f7qyLQHS5yyh6c5lZ/go2tTEeF5cbIkgmPhp5Uo2clRnc1xD kAb2PBZGZWDGvTMWPK39ZLDXRo47eXDSwBDWU/rOTqirVLZZiekN4dWXbJcq1VGM5mBmKg 299qIAAE+uf8H/VyMnOiBFCrJBTn+FknmTUK6KigzCwXDR24sfRIvDkUzWdHp9sGDAG5XH YzTSt5vCfeaCSON4em+0q+o46TeCNWhQBQrvcaFmuIeTPHW5Vinmm7DjbYajLcJZa5XmzR zEzb7xe/gY0na4wytwvWb2SrUDe9nqISfvxuvrBOgMfFZy6NgDMvBUJXLIZx0Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jQpms55X5zN2m for ; Fri, 13 Nov 2026 07:29:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1871b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 13 Nov 2026 07:29:49 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: da4aca33d26e - main - aw_ccu: d1: Set the lock enable bit of the PLLs List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: da4aca33d26eef787786f4ced9fab1337520de5d Auto-Submitted: auto-generated Date: Fri, 13 Nov 2026 07:29:49 +0000 Message-Id: <6af6bc6d.1871b.18ecc9e2@gitrepo.freebsd.org> The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=da4aca33d26eef787786f4ced9fab1337520de5d commit da4aca33d26eef787786f4ced9fab1337520de5d Author: Emmanuel Vadot AuthorDate: 2026-11-13 06:41:53 +0000 Commit: Emmanuel Vadot CommitDate: 2026-11-13 07:29:30 +0000 aw_ccu: d1: Set the lock enable bit of the PLLs The lock status bit of a PLL is only updated when its lock enable bit, bit 29, is set, and the firmware only sets it for the PLLs it uses. Enabling another PLL, or changing the rate of an enabled one, then waited for a lock that never came and ended after a second with an error. Set the bit on all the PLLs when attaching, like Linux does. Reported by: llm-postcr Fixes: 92b59f3d010d ("aw_clk: Wait for the PLL to lock when enabling it") --- sys/dev/clk/allwinner/ccu_d1.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/sys/dev/clk/allwinner/ccu_d1.c b/sys/dev/clk/allwinner/ccu_d1.c index cb9137976e69..45655b651812 100644 --- a/sys/dev/clk/allwinner/ccu_d1.c +++ b/sys/dev/clk/allwinner/ccu_d1.c @@ -1018,6 +1018,23 @@ static struct aw_ccung_clk ccu_d1_clks[] = { { .type = AW_CLK_DIV, .clk.div = &riscv_axi_clk}, }; +/* + * Registers of the PLLs, the lock status bit of a PLL is only updated when + * its lock enable bit is set. + */ +#define PLL_LOCK_ENABLE (1 << 29) + +static const bus_size_t d1_pll_regs[] = { + 0x00, /* PLL_CPUX */ + 0x10, /* PLL_DDR0 */ + 0x20, /* PLL_PERIPH0 */ + 0x40, /* PLL_VIDEO0 */ + 0x48, /* PLL_VIDEO1 */ + 0x58, /* PLL_VE */ + 0x78, /* PLL_AUDIO0 */ + 0x80, /* PLL_AUDIO1 */ +}; + static int ccu_d1_probe(device_t dev) { @@ -1035,6 +1052,8 @@ static int ccu_d1_attach(device_t dev) { struct aw_ccung_softc *sc; + uint32_t val; + int error, i; sc = device_get_softc(dev); @@ -1045,7 +1064,20 @@ ccu_d1_attach(device_t dev) sc->clks = ccu_d1_clks; sc->nclks = nitems(ccu_d1_clks); - return (aw_ccung_attach(dev)); + error = aw_ccung_attach(dev); + if (error != 0) + return (error); + + /* + * Only the PLLs used by the firmware have the lock enable bit set, + * set it for all of them so that we can wait for them to lock. + */ + for (i = 0; i < nitems(d1_pll_regs); i++) { + val = bus_read_4(sc->res, d1_pll_regs[i]); + bus_write_4(sc->res, d1_pll_regs[i], val | PLL_LOCK_ENABLE); + } + + return (0); } static device_method_t ccu_d1_methods[] = {