From patchwork Sat Sep 9 12:05:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 9945333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5629460224 for ; Sat, 9 Sep 2017 12:05:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C5BC287C6 for ; Sat, 9 Sep 2017 12:05:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D7F328A30; Sat, 9 Sep 2017 12:05:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A860F287C6 for ; Sat, 9 Sep 2017 12:05:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=RLxsCFgXJhMhLypMbD+MMW637OIGpWsytGPmHytKJ3M=; b=lew 4+yG5iUyvoJUml5CEYf/4cLGhUWZloG0rds3YuDcmvH96ea0V9AnOdGvG2DrIfXTQYsCkv3Cf6PQq uYbbrV/skdMpTEXnDjxNPEhVEgVOSJbK8nxbFiDQypA9m+3FdyBvuNJBwcbDyzOsIFiRTo5F5Pwau me1j20XQr2J10bCopPIZGdJ2oCWpCp7myQ2kQpQNZs5pJ8cck3IENRIDjZsnf+88TajQAhs4Yara7 T/LXgWdx9Ufm7XlAoox0FUfak9OjfubrZLtGANJW5glyHfrctv5+33CiyrWldNh/GJGWWDid7PX58 SIDPnNapWb60WfJCPCbmBAi+RZYLIFQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dqeW8-0007nt-QU; Sat, 09 Sep 2017 12:05:44 +0000 Received: from mail-it0-x242.google.com ([2607:f8b0:4001:c0b::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dqeW4-0007kU-Nv for linux-arm-kernel@lists.infradead.org; Sat, 09 Sep 2017 12:05:42 +0000 Received: by mail-it0-x242.google.com with SMTP id b76so2179896itb.2 for ; Sat, 09 Sep 2017 05:05:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=VZpqFP+g0YDZQWE7i8FlL2iIwwLxvz4pXngDA2ipUcw=; b=r6UiezkuHFAH+P7IhkuzCUWOLjTFKFzAkuPtVqryieuD0SzG2z5l/9wvaUwcV8efff qNoJodeb82x12ZhnBpdGyAAhZyqt9rYa1UzKVHQ4g0V0kl0e1/gJ0YcC9DW2Z2JlpElr 04cvhTX73uMVFKvvRij35G6p/nDepcYV5V0TF8pCi2eJuuUMDBzjOLPRV6kaYUQ4vuFq FFliIDePebU6Qllcwdc0TYGAK6H3kLwMLDzky6qPNQI3CXFsABK7sBsygX1RoI/LcfpO y7+7LPZneV9VHzQ/GOEWaZsqYbSwxp7V0k0HGEnEMLbg+Clj4/jZ2uVwH86Xw26G3NTi plFA== 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; bh=VZpqFP+g0YDZQWE7i8FlL2iIwwLxvz4pXngDA2ipUcw=; b=cxjdH1e5mlf4kiLOVOT7Iys3NSHORisFkWC3VoSBz3kZbbPdfbz9bDOGsfBES55nD6 eE0EVTZuJNuoXETfgKLsONV7M4zNW9u6vg5lvYGfuIG/MPuMwF22P83R6ndxF1s2NkLb o2wameqp95JNL9IYIMST7YxadYod/Wddz480PCXEnVBX0DGt097wSiTXBZHnv/xnYYph JJ0/pLOrCrzM+DDYLjVBFcmZtwX7aF+6L+7gzF32Lw3yPNMJ2vYozcHhG8zQ7U22PfzJ 8/vW2ySLbN6/EAAV8eHQJlQhKOqkSX92YmiFijyUX2tWMaWBlpUpoeiljoEr8ozM7P8e BVpg== X-Gm-Message-State: AHPjjUgEPsOLUJsS7+7ViIn9Sn0gq6j6ceh7JHsSQBNDpntvniLB95il WWWwX1gcXUK6qQfr/8Cdur5g2w== X-Google-Smtp-Source: AOwi7QDyGwJ4sBiE2ndqxbzFEYFaeXZB50zwwIXTTgOodeYd+awIT1a/8I6MNb6k/ZfIwanmbcLpcw== X-Received: by 10.36.22.137 with SMTP id a131mr4587086ita.52.1504958717197; Sat, 09 Sep 2017 05:05:17 -0700 (PDT) Received: from ubuntu16.lan (c-73-65-120-235.hsd1.mn.comcast.net. [73.65.120.235]) by smtp.gmail.com with ESMTPSA id k144sm2049019ita.38.2017.09.09.05.05.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 09 Sep 2017 05:05:16 -0700 (PDT) From: Adam Ford To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] davinci: Add cpufreq support when booting with device tree Date: Sat, 9 Sep 2017 07:05:09 -0500 Message-Id: <1504958709-23357-1-git-send-email-aford173@gmail.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170909_050540_874787_158A1E77 X-CRM114-Status: GOOD ( 11.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Adam Ford , nsekhar@ti.com, linux@armlinux.org.uk, khilman@kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP While cpufreq itself doesn't appear to directly support the device tree, we can register it inside da850_init_machine when we register other devices. Signed-off-by: Adam Ford --- arch/arm/mach-davinci/da8xx-dt.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c index 5699ce3..57e2ade 100644 --- a/arch/arm/mach-davinci/da8xx-dt.c +++ b/arch/arm/mach-davinci/da8xx-dt.c @@ -14,6 +14,7 @@ #include #include +#include #include #include "cp_intc.h" @@ -57,6 +58,28 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = { {} }; +#ifdef CONFIG_CPU_FREQ +static __init int da850_init_cpufreq(void) +{ + switch (system_rev & 0xF) { + case 3: + da850_max_speed = 456000; + break; + case 2: + da850_max_speed = 408000; + break; + case 1: + da850_max_speed = 372000; + break; + } + + return da850_register_cpufreq("pll0_sysclk3"); +} +#else +static __init int da850_init_cpufreq(void) { return 0; } +#endif + + #ifdef CONFIG_ARCH_DAVINCI_DA850 static void __init da850_init_machine(void) @@ -80,6 +103,10 @@ static void __init da850_init_machine(void) pr_warn("%s: registering SATA REFCLK failed: %d", __func__, ret); + ret = da850_init_cpufreq(); + if (ret) + pr_warn("%s: cpufreq registration failed: %d\n", __func__, ret); + of_platform_default_populate(NULL, da850_auxdata_lookup, NULL); davinci_pm_init(); pdata_quirks_init();