From patchwork Thu Dec 9 04:45:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hector Martin X-Patchwork-Id: 12695445 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6C69AC433EF for ; Thu, 9 Dec 2021 04:48:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tWfKlgR/lWzgSumMw30g9CuEGfPt36OXMrx6Xa7e604=; b=Kw+3rLP/WY1ESt PBklnwLN4ojyl//9guohec3hTQsyEcaj/UCvkECdTA0O4h+RP52S+EgFvPPD4Kc7exrK5SL3KbSVJ jVas4XJKLM+X4BU1iwhSU5fVsDaAzImmsxTSseTkex4csaguwNEpCWAPGmcGqUx6F+mBRZciXSE5K 3lH3jRjxz4/15XJo0BCrA978mFIR4qwNTWgTT0EDGM4WmWmqffWCE8ZgJO9mZWYWYisEcNXPyvuvA 5okNQOXt1L3wsiDcTbBSZ5Mp/WxgpFpI+cnCYJCFlQKWV8OI0cCUqHJYlcn/RCXtfCkHJGeu9kyVU /bdCQr/5/hhI2FH/ZDfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvBKF-00EvAY-Cj; Thu, 09 Dec 2021 04:46:35 +0000 Received: from marcansoft.com ([2a01:298:fe:f::2] helo=mail.marcansoft.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvBJu-00Ev7Y-U7 for linux-arm-kernel@lists.infradead.org; Thu, 09 Dec 2021 04:46:16 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (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) (Authenticated sender: hector@marcansoft.com) by mail.marcansoft.com (Postfix) with ESMTPSA id 68CCA41EA7; Thu, 9 Dec 2021 04:46:11 +0000 (UTC) From: Hector Martin To: Sven Peter , Rob Herring Cc: Hector Martin , Mark Kettenis , Alyssa Rosenzweig , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org Subject: [PATCH 2/3] soc: apple: apple-pmgr-pwrstate: Add auto-PM min level support Date: Thu, 9 Dec 2021 13:45:00 +0900 Message-Id: <20211209044501.67028-3-marcan@marcan.st> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211209044501.67028-1-marcan@marcan.st> References: <20211209044501.67028-1-marcan@marcan.st> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211208_204615_154697_C89713F3 X-CRM114-Status: GOOD ( 10.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This is seemingly required for DCP/DCPEXT, without which they refuse to boot properly. They need to be set to minimum state 4 (clock gated). Signed-off-by: Hector Martin Reviewed-by: Sven Peter --- drivers/soc/apple/apple-pmgr-pwrstate.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/soc/apple/apple-pmgr-pwrstate.c b/drivers/soc/apple/apple-pmgr-pwrstate.c index 8ad9d5fdefbf..590bb7439372 100644 --- a/drivers/soc/apple/apple-pmgr-pwrstate.c +++ b/drivers/soc/apple/apple-pmgr-pwrstate.c @@ -20,6 +20,7 @@ #define APPLE_PMGR_RESET BIT(31) #define APPLE_PMGR_AUTO_ENABLE BIT(28) #define APPLE_PMGR_PS_AUTO GENMASK(27, 24) +#define APPLE_PMGR_PS_MIN GENMASK(19, 16) #define APPLE_PMGR_PARENT_OFF BIT(11) #define APPLE_PMGR_DEV_DISABLE BIT(10) #define APPLE_PMGR_WAS_CLKGATED BIT(9) @@ -42,6 +43,7 @@ struct apple_pmgr_ps { struct reset_controller_dev rcdev; struct regmap *regmap; u32 offset; + u32 min_state; }; #define genpd_to_apple_pmgr_ps(_genpd) container_of(_genpd, struct apple_pmgr_ps, genpd) @@ -224,6 +226,12 @@ static int apple_pmgr_ps_probe(struct platform_device *pdev) ps->genpd.power_on = apple_pmgr_ps_power_on; ps->genpd.power_off = apple_pmgr_ps_power_off; + ret = of_property_read_u32(node, "apple,min-state", &ps->min_state); + if (ret >= 0) { + regmap_update_bits(regmap, ps->offset, APPLE_PMGR_FLAGS | APPLE_PMGR_PS_MIN, + FIELD_PREP(APPLE_PMGR_PS_MIN, ps->min_state)); + } + active = apple_pmgr_ps_is_active(ps); if (of_property_read_bool(node, "apple,always-on")) { ps->genpd.flags |= GENPD_FLAG_ALWAYS_ON;