Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5471283rwd; Wed, 24 May 2023 02:10:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Dh5r9S9G1IUhLRK3UWHp05U50TqG9pAg/iL+40epL11c6M7flitcxLw58wX0J0G4tfcxf X-Received: by 2002:a17:902:d342:b0:1ac:a6b0:1c87 with SMTP id l2-20020a170902d34200b001aca6b01c87mr16560833plk.48.1684919437880; Wed, 24 May 2023 02:10:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684919437; cv=none; d=google.com; s=arc-20160816; b=VC3gYTtVzF3zliEiCWMz4QhW7lHEk2ev+4gaeifwBUbTsPmbbG9L/K0BhVUXHWHrdL Z2RFBIYPRMvvUSyKRTSmftURNcflPjTEubLlycfVT5eE/nF96DzgorWXdyC0f7WQkzxA YtjWBjVbQVg8MFouXn+Jh1uW8PylSqFJBITb6VR5xv7UZcsfUwjdBGuJnxBspuiThSPY 1FvDN4UjRprSya9lgI94jvGd1pr0NMS+YzYualatMvU/79QsLo4WOvBFqKc4CJNu68IU Hs1879RI7OS6RViSpS1aLGEk/hHbHEd+uv1mRxNVpGKAiIndBY8e3JIAD+uustILMLb4 VhJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=eI4+PvQ8wJHFLjyWwBbPk81PRsHdngY9uD9XeDUAZk8=; b=LHf9g53snIxMV9oNfJW9TlPk+mzi/DRvw3QrdPXLLWlrrRQ06OEUw5KGOTMG8BY3fE hPYd851n+0P0omNXmT1hoZhR9NsqpIA/C8TOvPZIlCRQhchlPGtnfQLNmK19EYfuZWwz 8NkuiWjf2u6m/5eRa4/n9lk1baULko6SjiNDD97Acy7/GgBAEDwUK+r5IvDbASGxmlT4 YrxTe3FTTRIXDJwXqhuktX/tNeOwuiIjSrjkBfVyiVoLEPXwd9AZHurFRYm2wIwE69dE 3Lv2NMJfhRPuCx0vKbo0HqaBIkcFCBMNQZllE+uDjjAlUhQtvuQCDFGHS2uXyMIzFYSJ 0B+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iz11-20020a170902ef8b00b001a511254836si2478333plb.89.2023.05.24.02.10.23; Wed, 24 May 2023 02:10:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240426AbjEXIgd (ORCPT + 99 others); Wed, 24 May 2023 04:36:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240458AbjEXIf7 (ORCPT ); Wed, 24 May 2023 04:35:59 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 339B92129 for ; Wed, 24 May 2023 01:34:28 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q1jua-0002n8-Jw; Wed, 24 May 2023 10:32:00 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1q1juZ-002Ra5-9g; Wed, 24 May 2023 10:31:59 +0200 Received: from sha by dude02.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1q1juW-009jAe-LU; Wed, 24 May 2023 10:31:56 +0200 From: Sascha Hauer To: linux-rockchip@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Heiko Stuebner , Kyungmin Park , MyungJoo Ham , Will Deacon , Mark Rutland , kernel@pengutronix.de, Michael Riesch , Robin Murphy , Vincent Legoll , Rob Herring , Krzysztof Kozlowski , Conor Dooley , devicetree@vger.kernel.org, Sascha Hauer , Jonathan Cameron Subject: [PATCH v5 11/25] PM / devfreq: rockchip-dfi: Handle LPDDR2 correctly Date: Wed, 24 May 2023 10:31:39 +0200 Message-Id: <20230524083153.2046084-12-s.hauer@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230524083153.2046084-1-s.hauer@pengutronix.de> References: <20230524083153.2046084-1-s.hauer@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org According to the downstream driver the DDRMON_CTRL_LPDDR23 bit must be set for both LPDDR2 and LPDDR3. Add the missing LPDDR2 case and while at it turn the if/else if/else into switch/case which makes it easier to read. Signed-off-by: Sascha Hauer Reviewed-by: Jonathan Cameron --- drivers/devfreq/event/rockchip-dfi.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/devfreq/event/rockchip-dfi.c b/drivers/devfreq/event/rockchip-dfi.c index 261d112580c9e..16cd5365671f7 100644 --- a/drivers/devfreq/event/rockchip-dfi.c +++ b/drivers/devfreq/event/rockchip-dfi.c @@ -82,12 +82,19 @@ static void rockchip_dfi_start_hardware_counter(struct devfreq_event_dev *edev) DDRMON_CTRL_HARDWARE_EN), dfi_regs + DDRMON_CTRL); /* set ddr type to dfi */ - if (dfi->ddr_type == ROCKCHIP_DDRTYPE_LPDDR3) + switch (dfi->ddr_type) { + case ROCKCHIP_DDRTYPE_LPDDR2: + case ROCKCHIP_DDRTYPE_LPDDR3: writel_relaxed(HIWORD_UPDATE(DDRMON_CTRL_LPDDR23, DDRMON_CTRL_DDR_TYPE_MASK), dfi_regs + DDRMON_CTRL); - else if (dfi->ddr_type == ROCKCHIP_DDRTYPE_LPDDR4) + break; + case ROCKCHIP_DDRTYPE_LPDDR4: writel_relaxed(HIWORD_UPDATE(DDRMON_CTRL_LPDDR4, DDRMON_CTRL_DDR_TYPE_MASK), dfi_regs + DDRMON_CTRL); + break; + default: + break; + } /* enable count, use software mode */ writel_relaxed(HIWORD_UPDATE(DDRMON_CTRL_SOFTWARE_EN, DDRMON_CTRL_SOFTWARE_EN), -- 2.39.2