From patchwork Tue Dec 17 01:40:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Tobias X-Patchwork-Id: 3358241 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 62DD99F380 for ; Tue, 17 Dec 2013 01:41:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 931BE2020A for ; Tue, 17 Dec 2013 01:41:38 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D8D3A200EB for ; Tue, 17 Dec 2013 01:41:36 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vsjef-0000mG-FK; Tue, 17 Dec 2013 01:41:01 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VsjeW-0004j5-O9; Tue, 17 Dec 2013 01:40:52 +0000 Received: from mail-oa0-x232.google.com ([2607:f8b0:4003:c02::232]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VsjeJ-0004hS-N5 for linux-arm-kernel@lists.infradead.org; Tue, 17 Dec 2013 01:40:40 +0000 Received: by mail-oa0-f50.google.com with SMTP id n16so5899022oag.37 for ; Mon, 16 Dec 2013 17:40:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=JbakX4NyJb4RzITS5sPig7gZ9gCT6Mez8Za7zAfb8vc=; b=s5vtHIXt026dGaR633q9kUt/7GfA5OGvFkI6VxuzhDOgTbYsR8ZCXraZWkmbJMYOjX E+K22PiCZ8eAL43notTpIYGk2o36GN4xMjFySV6kwqqL+tcFkOfhMf9yoBKKkz+fMqtT GzU6GJJvo6ZYQIUBAGwLhUdV5wIJgwXVHVQtADyFCTSy5/bS97umazZ3dlFxohsIcTud 7ycEe0GAdXRZ550jltPFVoOSEJRN6KpGXLSHjJZgpUl/f2iYDczV/lS9Iw8alLt2FLsO jG/4OajuWEl991mOWnD+Kjgm3cxiNEslY9OZPZO5V6r/xtfXRhvc1jVnfJna8Jpk+kO+ UK4w== MIME-Version: 1.0 X-Received: by 10.182.112.130 with SMTP id iq2mr8914503obb.57.1387244418355; Mon, 16 Dec 2013 17:40:18 -0800 (PST) Received: by 10.60.36.166 with HTTP; Mon, 16 Dec 2013 17:40:18 -0800 (PST) Date: Mon, 16 Dec 2013 17:40:18 -0800 Message-ID: Subject: [PATCH 2/3]: Support cpu frequency scaling and power management for iMX6SL From: John Tobias To: linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, Shawn Guo , Fabio Estevam , Chris Ball X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131216_204039_852211_4105382F X-CRM114-Status: GOOD ( 10.93 ) X-Spam-Score: -2.0 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP iMX6SL re-using iMX6Q driver in order to enable the cpu frequency scaling and power management From: John Tobias MACHINE_END diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c index 2f952e3..e66eccf 100644 --- a/arch/arm/mach-imx/mach-imx6sl.c +++ b/arch/arm/mach-imx/mach-imx6sl.c @@ -9,7 +9,10 @@ #include #include +#include +#include #include +#include #include #include #include @@ -17,6 +20,7 @@ #include #include "common.h" +#include "cpuidle.h" static void __init imx6sl_fec_init(void) { @@ -34,6 +38,47 @@ static void __init imx6sl_fec_init(void) } } + +static void __init imx6sl_opp_init(void) +{ + struct device_node *np; + struct device *cpu_dev = get_cpu_device(0); + + if (!cpu_dev) { + pr_warn("failed to get cpu0 device\n"); + return; + } + np = of_node_get(cpu_dev->of_node); + if (!np) { + pr_warn("failed to find cpu0 node\n"); + return; + } + + if (of_init_opp_table(cpu_dev)) { + pr_warn("failed to init OPP table\n"); + goto put_node; + } + +put_node: + of_node_put(np); +} + +static struct platform_device imx6q_cpufreq_pdev = { + .name = "imx6q-cpufreq", +}; + + +static void __init imx6sl_init_late(void) +{ + /* re-use imx6q */ + imx6q_cpuidle_init(); + + if (IS_ENABLED(CONFIG_ARM_IMX6SQ_CPUFREQ)) { + imx6sl_opp_init(); + platform_device_register(&imx6q_cpufreq_pdev); + } +} + static void __init imx6sl_init_machine(void) { struct device *parent; @@ -70,6 +115,7 @@ DT_MACHINE_START(IMX6SL, "Freescale i.MX6 SoloLite (Device Tree)") .map_io = debug_ll_io_init, .init_irq = imx6sl_init_irq, .init_machine = imx6sl_init_machine, + .init_late = imx6sl_init_late, .dt_compat = imx6sl_dt_compat, .restart = mxc_restart,