From patchwork Wed Aug 16 08:19:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 110214 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp474009qge; Wed, 16 Aug 2017 01:19:30 -0700 (PDT) X-Received: by 10.98.150.75 with SMTP id c72mr897330pfe.58.1502871570588; Wed, 16 Aug 2017 01:19:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502871570; cv=none; d=google.com; s=arc-20160816; b=oBuns46Hfkp7xb0EJlE5fvRW+gQhDj9LAIGGigassQrC38iEg48ZpiN2Tkg7ANtwfw jTbq9IrEg9/IHHhL48VB5NryFNvUuTODs/uHlbQgspOxXbqTXhWrr+FRhNDUhZzaLz3g G3IrVy29cUoN6MNLooGOg9BYeQF0qUjJ1L6MPfrQltRTsKRM2UPZFHPxVsyo2Yz0QZ0h 0BmrEayMyrGAU5TpPno67xl39CS5KPqTFel9b6JeRb365z27f8NPeBEFwNbKR/mz9uQ3 oJWy065iiUal0VMyCaqomzbVEjF42LcwSVYbtrU2r3mJH0GRij/8yIah7ozjxqPAif+R UU1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=fX5Aeo807L2cgmWRaCwN2fr3VznPDIHKa7IwME7uIGo=; b=YE95Hcsp1xVYcA++olrarUuEECfkIIWSBtYzCX5d8+6E3KxH7OFWrWAPu6I4rU9yAg ANhF3xu62q1XvlAfjP4lSGLXNpZ1ErZB96AnRAIqJzGN2IIrbU1zdLtEzqBBtMjwIC7a agOORkmk6zvsfyM0c64DJVK7qsQn/fMQFfiiH1sEoX/Ds/9SGJg6TPzkMeesQcenBDCH jgkpuTB5eUbN2y02geBO/VwL2iat9Hp8qOAc0p9HW0JccS8hG7Fjl/PaJaNOwqW6k0wc KnM8NBPJvzA9CDZmGMjwfjcFp4wFsy7pDvOO2GS22x5ZdVJry6PZWqs77w+FaPEY0Nb6 +eDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hl6VIj6v; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a5si180762pgc.354.2017.08.16.01.19.30; Wed, 16 Aug 2017 01:19:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hl6VIj6v; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751692AbdHPIT3 (ORCPT + 12 others); Wed, 16 Aug 2017 04:19:29 -0400 Received: from mail-lf0-f51.google.com ([209.85.215.51]:36280 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751679AbdHPIT2 (ORCPT ); Wed, 16 Aug 2017 04:19:28 -0400 Received: by mail-lf0-f51.google.com with SMTP id o85so13218352lff.3 for ; Wed, 16 Aug 2017 01:19:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fX5Aeo807L2cgmWRaCwN2fr3VznPDIHKa7IwME7uIGo=; b=Hl6VIj6vu6wiv9S05XVz3r77WwPqESsWHbQ3XbEtqtFmcU1lLu77nhIalkwZ10hpzg xqshuSdn1tAsTjOu33CTWRKIKuETrFbXdUJAAo033rDCO4KHbev+oHYWNRBMavVMKfBr 6CinZJ9PF/4Fvd7ByMcLNpd4ATH/HybBiQ9pk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fX5Aeo807L2cgmWRaCwN2fr3VznPDIHKa7IwME7uIGo=; b=Kd9g18d8E2LdWSWWQ/rTfM0hwdgMH0GzFd69u63+7K0aZwUueH7LnkVMrm63ECd86m vguGrPdTDJjPcpEOxlsiiBCTqSGue9vF4gSwsr6snU+KjoC+pjKp2u33H4hGwLtOPcqD TG4btadfW3q4zM383A1F/n9HCP/p3dgNsQWLZRUdsJMh4NKvsWU6ws99+KrJCJWidv1P bJp08iBnwFKmXN80B6QEkkj03kW/ex7SevD/NwQMvVI9kbNCac6M1l4empewh/rUqyrx FubyadtHWtLxcWkvJfLDPC7FEiKO5L+NuhMqmVLOWND/0+eBHCGtbRZFgEZ2muCPx7q0 UDWw== X-Gm-Message-State: AHYfb5hYwDRJwDWRXgFDZolz3c5D4yKcODfYCS21WquNSRR1XvsEW1OZ H2yXCKy04qx5Adwh X-Received: by 10.25.83.65 with SMTP id h62mr298134lfb.149.1502871566912; Wed, 16 Aug 2017 01:19:26 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id g41sm70742lji.94.2017.08.16.01.19.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Aug 2017 01:19:26 -0700 (PDT) From: Linus Walleij To: "Rafael J . Wysocki" , Viresh Kumar , Lee Jones Cc: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Ulf Hansson , Linus Walleij Subject: [PATCH 2/3 v2] mfd: db8500-prcmu: Get rid of cpufreq dependency Date: Wed, 16 Aug 2017 10:19:13 +0200 Message-Id: <20170816081914.30471-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170816081914.30471-1-linus.walleij@linaro.org> References: <20170816081914.30471-1-linus.walleij@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The ARMSS clock, also known as the operating point of the CPU, should not cross-depend on cpufreq like this. Move the code to use just frequencies and remove the false frequency (1GHz) and put in the actual frequency provided by the ARMSS clock (998400000 Hz) as part of the process. After this and the related cpufreq patch, the DB8500 will simply use the standard DT cpufreq driver to change the operating points through the common clock framework using the ARMSS clock. Acked-by: Lee Jones Signed-off-by: Linus Walleij --- ChangeLog v1-v2: - Added Lee's ACK. Please apply this to the cpufreq tree. This MFD driver is very seldom touched to it shouldn't create any conflicts. --- drivers/mfd/db8500-prcmu.c | 60 ++++++++++++++-------------------------------- 1 file changed, 18 insertions(+), 42 deletions(-) -- 2.13.5 diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index 5c739ac752e8..cc6dc5dd20d2 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include "dbx500-prcmu-regs.h" @@ -1692,32 +1691,23 @@ static long round_clock_rate(u8 clock, unsigned long rate) return rounded_rate; } -/* CPU FREQ table, may be changed due to if MAX_OPP is supported. */ -static struct cpufreq_frequency_table db8500_cpufreq_table[] = { - { .frequency = 200000, .driver_data = ARM_EXTCLK,}, - { .frequency = 400000, .driver_data = ARM_50_OPP,}, - { .frequency = 800000, .driver_data = ARM_100_OPP,}, - { .frequency = CPUFREQ_TABLE_END,}, /* To be used for MAX_OPP. */ - { .frequency = CPUFREQ_TABLE_END,}, -}; +static const unsigned long armss_freqs[] = { 200000000, 400000000, + 800000000, 998400000 }; static long round_armss_rate(unsigned long rate) { - struct cpufreq_frequency_table *pos; - long freq = 0; - - /* cpufreq table frequencies is in KHz. */ - rate = rate / 1000; + unsigned long freq = 0; + int i; /* Find the corresponding arm opp from the cpufreq table. */ - cpufreq_for_each_entry(pos, db8500_cpufreq_table) { - freq = pos->frequency; - if (freq == rate) + for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) { + freq = armss_freqs[i]; + if (rate <= freq) break; } /* Return the last valid value, even if a match was not found. */ - return freq * 1000; + return freq; } #define MIN_PLL_VCO_RATE 600000000ULL @@ -1854,21 +1844,23 @@ static void set_clock_rate(u8 clock, unsigned long rate) static int set_armss_rate(unsigned long rate) { - struct cpufreq_frequency_table *pos; - - /* cpufreq table frequencies is in KHz. */ - rate = rate / 1000; + unsigned long freq; + u8 opps[] = { ARM_EXTCLK, ARM_50_OPP, ARM_100_OPP, ARM_MAX_OPP }; + int i; /* Find the corresponding arm opp from the cpufreq table. */ - cpufreq_for_each_entry(pos, db8500_cpufreq_table) - if (pos->frequency == rate) + for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) { + freq = armss_freqs[i]; + if (rate == freq) break; + } - if (pos->frequency != rate) + if (rate != freq) return -EINVAL; /* Set the new arm opp. */ - return db8500_prcmu_set_arm_opp(pos->driver_data); + pr_debug("SET ARM OPP 0x%02x\n", opps[i]); + return db8500_prcmu_set_arm_opp(opps[i]); } static int set_plldsi_rate(unsigned long rate) @@ -3049,12 +3041,6 @@ static const struct mfd_cell db8500_prcmu_devs[] = { .pdata_size = sizeof(db8500_regulators), }, { - .name = "cpufreq-ux500", - .of_compatible = "stericsson,cpufreq-ux500", - .platform_data = &db8500_cpufreq_table, - .pdata_size = sizeof(db8500_cpufreq_table), - }, - { .name = "cpuidle-dbx500", .of_compatible = "stericsson,cpuidle-dbx500", }, @@ -3067,14 +3053,6 @@ static const struct mfd_cell db8500_prcmu_devs[] = { }, }; -static void db8500_prcmu_update_cpufreq(void) -{ - if (prcmu_has_arm_maxopp()) { - db8500_cpufreq_table[3].frequency = 1000000; - db8500_cpufreq_table[3].driver_data = ARM_MAX_OPP; - } -} - static int db8500_prcmu_register_ab8500(struct device *parent) { struct device_node *np; @@ -3160,8 +3138,6 @@ static int db8500_prcmu_probe(struct platform_device *pdev) prcmu_config_esram0_deep_sleep(ESRAM0_DEEP_SLEEP_STATE_RET); - db8500_prcmu_update_cpufreq(); - err = mfd_add_devices(&pdev->dev, 0, common_prcmu_devs, ARRAY_SIZE(common_prcmu_devs), NULL, 0, db8500_irq_domain); if (err) {