From mboxrd@z Thu Jan 1 00:00:00 1970 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 B88CCC3DA7D for ; Thu, 5 Jan 2023 15:35:24 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D0B5E855D6; Thu, 5 Jan 2023 16:34:55 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="IM9P/jFu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EAFFE855C9; Thu, 5 Jan 2023 16:34:46 +0100 (CET) Received: from mail-oa1-x32.google.com (mail-oa1-x32.google.com [IPv6:2001:4860:4864:20::32]) (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 5AB408557E for ; Thu, 5 Jan 2023 16:34:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=macroalpha82@gmail.com Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-15085b8a2f7so18499413fac.2 for ; Thu, 05 Jan 2023 07:34:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kajUx2hi5xb1zPcHx/TeH52H51i8wvOhSTMI989IR9w=; b=IM9P/jFuqx8r4Njmt0mGkHQ1Wuz0zBlEP3l+ROAaq/+PK55Pkh/XUK591k1yYNSbY0 ry/6kNgEjoZcwhN0Y6EVlcaA9fT20Zq02z6cFIiCCjX969SFbgpPlpxhpdpiBeS1yO3W Ez7TYU4oge29SLcaEqrkCq0sOuO7vdGZdSvLqa2VtZza0aOoapYMmKYnprxOeFfoda25 Wy13u2zVN5/ALrw8+BOepOkr672c6IUqOz2hK3+1PcA8fuZxB+aJo1XyCGpOKQ2FOhbG Recn5SRuCwPF0GhpawOToCfE8pwPdZO4m4jBbmpLBlMRc41ekpWEpfrhn6s7Pzd50iyi UACg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kajUx2hi5xb1zPcHx/TeH52H51i8wvOhSTMI989IR9w=; b=ZJ2kxl3Kry6I8du73m64d2yf/t+0ZoxCmnNkCgFjj56N/yi56Y90L+tRrD4DIUcUQ/ 6xbW0ivK2PxHP7zQcgJWyEgWyUOyzCY/adH9D5CklKGLUKDa9M5yx1RBRmsrwwaMXUGt x9RtoD6yK4pWqrcHcRHo3v8laZdUVtenTYxcI3aofuC1BAG4yHY/yAPEWHY1Hjt4pE2n xLQWulNnLATD8UrH0e3YGNlNUMSROJBM/5f4Ih1fdQv69wA7pF3awJDAR2ne2/IxbDM8 6tSCZOVj2BJTbbBy9q4hPRzUz8jguC2IJQiHBk7LL7IPygV9ZrL7ARQhKnsuRlW2EF1q M59A== X-Gm-Message-State: AFqh2koTZGUMPeTk+G9JlyaDTgfSWReU0HtqU2PdoIEdOTn25tDmaHgt teHvh4d7ErKyKNl7wQ5fv+XfTCrWKI0= X-Google-Smtp-Source: AMrXdXt42IVf/IVqrdswelKHXm6AMKoeLJGDYIB+4E2ZrXhmToL14of10sOhg4K4AoGfwHyunCu8wg== X-Received: by 2002:a05:6870:3c0c:b0:144:4246:9f3a with SMTP id gk12-20020a0568703c0c00b0014442469f3amr23661396oab.17.1672932881785; Thu, 05 Jan 2023 07:34:41 -0800 (PST) Received: from localhost.localdomain (76-244-6-13.lightspeed.rcsntx.sbcglobal.net. [76.244.6.13]) by smtp.gmail.com with ESMTPSA id l39-20020a05687106a700b0014fb4bdc746sm15453963oao.8.2023.01.05.07.34.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 07:34:41 -0800 (PST) From: Chris Morgan To: u-boot@lists.denx.de Cc: sjg@chromium.org, philipp.tomsich@vrull.eu, kever.yang@rock-chips.com, chenjh@rock-chips.com, pgwipeout@gmail.com, heiko.stuebner@theobroma-systems.com, Chris Morgan Subject: [PATCH 4/5] rockchip: rk3568: enable automatic power savings Date: Thu, 5 Jan 2023 09:34:27 -0600 Message-Id: <20230105153428.392250-5-macroalpha82@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230105153428.392250-1-macroalpha82@gmail.com> References: <20230105153428.392250-1-macroalpha82@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.6 at phobos.denx.de X-Virus-Status: Clean From: Chris Morgan This is adapted from Peter Geis's work located here: https://gitlab.com/pgwipeout/u-boot-quartz64/-/commit/ec20b790adc41bb400e2c523cb35ffee14e223f4 It enables automatic clock gating on idle, disables the eDP phy by default, and sets the core pvtpll ring length. It is reported this lowers the temperature on at least one SoC by 7C. Signed-off-by: Chris Morgan --- arch/arm/mach-rockchip/rk3568/rk3568.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/arm/mach-rockchip/rk3568/rk3568.c b/arch/arm/mach-rockchip/rk3568/rk3568.c index a2d59abc26..4a08820a09 100644 --- a/arch/arm/mach-rockchip/rk3568/rk3568.c +++ b/arch/arm/mach-rockchip/rk3568/rk3568.c @@ -24,6 +24,16 @@ #define SGRF_SOC_CON4 0x10 #define EMMC_HPROT_SECURE_CTRL 0x03 #define SDMMC0_HPROT_SECURE_CTRL 0x01 + +#define PMU_BASE_ADDR 0xfdd90000 +#define PMU_NOC_AUTO_CON0 (0x70) +#define PMU_NOC_AUTO_CON1 (0x74) +#define EDP_PHY_GRF_BASE 0xfdcb0000 +#define EDP_PHY_GRF_CON0 (EDP_PHY_GRF_BASE + 0x00) +#define EDP_PHY_GRF_CON10 (EDP_PHY_GRF_BASE + 0x28) +#define CPU_GRF_BASE 0xfdc30000 +#define GRF_CORE_PVTPLL_CON0 (0x10) + /* PMU_GRF_GPIO0D_IOMUX_L */ enum { GPIO0D1_SHIFT = 4, @@ -98,6 +108,20 @@ void board_debug_uart_init(void) int arch_cpu_init(void) { #ifdef CONFIG_SPL_BUILD + /* + * When perform idle operation, corresponding clock can + * be opened or gated automatically. + */ + writel(0xffffffff, PMU_BASE_ADDR + PMU_NOC_AUTO_CON0); + writel(0x000f000f, PMU_BASE_ADDR + PMU_NOC_AUTO_CON1); + + /* Disable eDP phy by default */ + writel(0x00070007, EDP_PHY_GRF_CON10); + writel(0x0ff10ff1, EDP_PHY_GRF_CON0); + + /* Set core pvtpll ring length */ + writel(0x00ff002b, CPU_GRF_BASE + GRF_CORE_PVTPLL_CON0); + /* Set the emmc sdmmc0 to secure */ rk_clrreg(SGRF_BASE + SGRF_SOC_CON4, (EMMC_HPROT_SECURE_CTRL << 11 | SDMMC0_HPROT_SECURE_CTRL << 4)); -- 2.34.1