Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E3AFBC04A94 for ; Fri, 4 Aug 2023 09:34:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0578686947; Fri, 4 Aug 2023 11:34:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.b="SdiDTso9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 504DF86819; Fri, 4 Aug 2023 11:34:03 +0200 (CEST) Received: from s.wrqvtbkv.outbound-mail.sendgrid.net (s.wrqvtbkv.outbound-mail.sendgrid.net [149.72.123.24]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6957C86776 for ; Fri, 4 Aug 2023 11:34:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bounces+31435339-7456-u-boot=lists.denx.de@em2124.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=BSgz7cENZTS0O2JwXzBaXSEf6ntTMT8pFzshJ7UNc68=; b=SdiDTso9IZ5pBlr5oz+OiumIYd4QbaZrkH39M3Tg4vs1sQ24E+zQIuDWl6/gTcKlMaH/ 9D38HYK/aImT+vLEJPr/jcAb2aC3tlFr+oJGyXOifMeeHNRuSSGhIwGVnBDRrD1iyoI0o4 28Hr3DsuczEnW4mKt5Yy+gSKLztCV2NG2gA0exPnEY++K7OdGSwy8DzjKIZi3M34Vt787p SvucVCK4eLo2/k81u+oiUs1hRPY2khfQVa7YlBcC6R2SL7pG8esv5u39vDc/b3NuEZD193 jsu98S+ZqDeg+gT9bWvlSZbc6PL0CZrqp6ftOrymma06NteGiehHtEBpVNOV3hzw== Received: by filterdrecv-d7bbbc8bf-nzpnk with SMTP id filterdrecv-d7bbbc8bf-nzpnk-1-64CCC606-21 2023-08-04 09:33:58.81950531 +0000 UTC m=+7379645.763696880 Received: from bionic.localdomain (unknown) by geopod-ismtpd-4 (SG) with ESMTP id wBD5wRJdRYK_Zr2XTrWpCg Fri, 04 Aug 2023 09:33:58.547 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 2/5] clk: rockchip: rk3568: Fix mask for clk_cpll_div_25m_div Date: Fri, 04 Aug 2023 09:33:59 +0000 (UTC) Message-ID: <20230804093354.6619-3-jonas@kwiboo.se> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230804093354.6619-1-jonas@kwiboo.se> References: <20230804093354.6619-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxA?= =?us-ascii?Q?fZekEeQsTe+RrMu3cja6a0h2JJqbDVgiJHOry9m?= =?us-ascii?Q?DSKEzl7I9kvRTJ+cVL2ocuujdfu4kBbmm2wX+IN?= =?us-ascii?Q?v=2Fut3cpuMAVD+Cvk84bh9bxTM6plI4idszvVy6p?= =?us-ascii?Q?MAX2pTfxLhEa2JiSMMjkjFBFN9PG1OBy6zcNKmP?= =?us-ascii?Q?24qfmVtwIIic9+HyAZAPeav8N8sYRw+dsTkhn6?= To: Kever Yang , Simon Glass , Philipp Tomsich , Lukasz Majewski , Sean Anderson , Elaine Zhang Cc: u-boot@lists.denx.de, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The field for clk_cpll_div_25m_div in CRU_CLKSEL_CON81 is 6 bits wide, not 5 bits wide as currently defined in CPLL_25M_DIV_MASK. Fix this and the assert so that CPLL_25M can be assigned a 25 MHz rate. Fixes: 4a262feba3a5 ("rockchip: rk3568: add clock driver") Signed-off-by: Jonas Karlman --- arch/arm/include/asm/arch-rockchip/cru_rk3568.h | 2 +- drivers/clk/rockchip/clk_rk3568.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/arch-rockchip/cru_rk3568.h b/arch/arm/include/asm/arch-rockchip/cru_rk3568.h index 399f19ad21ec..2cf590d6d717 100644 --- a/arch/arm/include/asm/arch-rockchip/cru_rk3568.h +++ b/arch/arm/include/asm/arch-rockchip/cru_rk3568.h @@ -493,7 +493,7 @@ enum { /* CRU_CLK_SEL81_CON */ CPLL_25M_DIV_SHIFT = 8, - CPLL_25M_DIV_MASK = 0x1f << CPLL_25M_DIV_SHIFT, + CPLL_25M_DIV_MASK = 0x3f << CPLL_25M_DIV_SHIFT, CPLL_50M_DIV_SHIFT = 0, CPLL_50M_DIV_MASK = 0x1f << CPLL_50M_DIV_SHIFT, diff --git a/drivers/clk/rockchip/clk_rk3568.c b/drivers/clk/rockchip/clk_rk3568.c index e8e4d20e532c..dab254d4d115 100644 --- a/drivers/clk/rockchip/clk_rk3568.c +++ b/drivers/clk/rockchip/clk_rk3568.c @@ -702,7 +702,10 @@ static ulong rk3568_cpll_div_set_rate(struct rk3568_clk_priv *priv, } div = DIV_ROUND_UP(priv->cpll_hz, rate); - assert(div - 1 <= 31); + if (clk_id == CPLL_25M) + assert(div - 1 <= 63); + else + assert(div - 1 <= 31); rk_clrsetreg(&cru->clksel_con[con], mask, (div - 1) << shift); return rk3568_cpll_div_get_rate(priv, clk_id); -- 2.41.0