Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3600297rdg; Tue, 17 Oct 2023 23:20:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF5307rpdmVWQmYVsHoKgBydrQRXWkN5Y2G+uDrMjaYqATzG/5S/ZT9UZ+LyfdZ4mha9Ivo X-Received: by 2002:a05:6e02:2145:b0:351:4f0c:b95c with SMTP id d5-20020a056e02214500b003514f0cb95cmr5657921ilv.24.1697610012399; Tue, 17 Oct 2023 23:20:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697610012; cv=none; d=google.com; s=arc-20160816; b=NKObN1PloV0qNWV+y6UI9ma7C+2ts9OVC9sOHvNi2RxA8UraJPhWmx8ibBBBNhydq/ 4+aBNAzl5IXmgtW4wUoFEeg6Y792hoT9sFKjhYgAO27hD1ngLpEx6VgwVzHayJD8MvSf S4dVOzG9HtamhvB3KmwLgz+DfQyQCp6UDaqmWDOPfZgUkKG0IpUI/DwNrz491yGJTKg4 UCRY19bHDJHiM+fOLOIMfmf7AzYax5EpS7u6zgCer4ibM1IQGWMrOr8H4us8Ht8gsUnC QOlLClJKfGGJSpDY/7l0UA3cWpDMor8A6WG8M0BTrp7mzfgs9ZPlM40OP8K6YMI2ri96 +l8g== 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=xcijpG9ed/Lru55jv3Xlg++FC7DpAEYaw5drC3YQ9bw=; fh=1oaOtDPKrJahflgDzvESyfR8FC6mi/x4WJYS7DpyfkE=; b=OwFza8yTRsMiCDuPkxQVmZLsahpAmpU9TaQUqGrlt1pjm8JIvfjbDz4icNkGWyc5aO M5FIp1j5JYrORhrIQV0wBHCxhT1YQCcHlE5q5camLgPijyjgguXoL10qO5W4il4lcnk6 ad/XJcAz323PKlPOf+3yTNAf2J1rrHEq9jzwDrlEwVH3I2mh4T+IrXokb6zuiV6ptyyR OYxh1xCNa/ww2ZXP77cj8Ca69o0Yz6ij7CQtBI9s5qlqJP2h29g5Ogn/IQn6dLkroZ0h 3WLOyR12QZb6w8Ue/ZGAninucRDiS+vbySDoxdbu6RKppvNqeD2aINVNdynEr5z2Gt4V YdvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id b13-20020a6567cd000000b0059c78eb3fe7si1493713pgs.838.2023.10.17.23.20.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 23:20:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 0EEA6802407D; Tue, 17 Oct 2023 23:20:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230465AbjJRGT6 (ORCPT + 99 others); Wed, 18 Oct 2023 02:19:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235073AbjJRGSq (ORCPT ); Wed, 18 Oct 2023 02:18:46 -0400 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EDE5D6F for ; Tue, 17 Oct 2023 23:18:03 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qszru-0001Zr-CN; Wed, 18 Oct 2023 08:17:22 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qszrq-002UYE-TZ; Wed, 18 Oct 2023 08:17:18 +0200 Received: from sha by dude02.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1qszrq-00Evid-2e; Wed, 18 Oct 2023 08:17:18 +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 , Chanwoo Choi , 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, Sebastian Reichel , Sascha Hauer , Jonathan Cameron , Chanwoo Choi Subject: [PATCH v8 11/26] PM / devfreq: rockchip-dfi: Handle LPDDR2 correctly Date: Wed, 18 Oct 2023 08:16:59 +0200 Message-Id: <20231018061714.3553817-12-s.hauer@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231018061714.3553817-1-s.hauer@pengutronix.de> References: <20231018061714.3553817-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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 17 Oct 2023 23:20:08 -0700 (PDT) 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. Reviewed-by: Jonathan Cameron Reviewed-by: Sebastian Reichel Acked-by: Chanwoo Choi Signed-off-by: Sascha Hauer --- 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 571d72d1abd1c..8ce0191552ef1 100644 --- a/drivers/devfreq/event/rockchip-dfi.c +++ b/drivers/devfreq/event/rockchip-dfi.c @@ -83,12 +83,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