From patchwork Fri Jul 26 10:19:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2833966 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A7333C0319 for ; Fri, 26 Jul 2013 10:19:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 09F5A20125 for ; Fri, 26 Jul 2013 10:19:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B6C782010B for ; Fri, 26 Jul 2013 10:19:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758037Ab3GZKTf (ORCPT ); Fri, 26 Jul 2013 06:19:35 -0400 Received: from moutng.kundenserver.de ([212.227.17.9]:58986 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751983Ab3GZKTe (ORCPT ); Fri, 26 Jul 2013 06:19:34 -0400 Received: from axis700.grange (dslb-094-221-102-122.pools.arcor-ip.net [94.221.102.122]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0MDl62-1UsFme2KfG-00HN9q; Fri, 26 Jul 2013 12:19:22 +0200 Received: by axis700.grange (Postfix, from userid 1000) id 2A6E640BB4; Fri, 26 Jul 2013 12:19:22 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id 26D7940BB3; Fri, 26 Jul 2013 12:19:22 +0200 (CEST) Date: Fri, 26 Jul 2013 12:19:22 +0200 (CEST) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: linux-sh@vger.kernel.org cc: Magnus Damm , cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Shawn Guo Subject: [PATCH] cpufreq-cpu0: support Device Tree initialisation Message-ID: MIME-Version: 1.0 X-Provags-ID: V02:K0:/lxqG7TFRCcrY187ctTK3lpbb2/cqBk65nJz4gagw0p KE+LCwfdO3msjyWToVsTwq4mbv4hmiSaD7KH8cGnxpW8CAWZDB Qc6a0vxwClIs6TWTCp04abdtVzWgT9Fyv1XbGX5TtzCSsJkMBF tgNA2PXSyoxWZbcd+YkVDFxPJulnn93dEupq81CTKvsuDUa6Ek WtsXG+QvL6+DzNzMJYruGfp3QuwJog05bqDbPH+jVKv+CP9o/1 p02zhJq4VJtlAcozdK5prj6/PSsmIiCrUZY/If9w5z7OaL2hIh xk8PfRfetjp8spCJlkxhOOrDcYUitVdu8SuG1Yg68ZDlNBbltY xVkLBoueEHq7QxILH+PiCTZ8aaC+Ph9w02Ou4ONx0F+Pc8HeKu cG3mbc7Jn6WVw== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Currently the cpufreq-cpu0 driver doesn't support Device Tree probing. To support it we add an OF match table to it. In principle this alone is enough to get the driver working with DT devices, but then the driver rewrites the .of_node field of the probed device with a different one, which isn't clean. To avoid this we use the cpu0 system device for clock and OPP handling, similar to what the arm_big_little CPUFreq driver does. This is also less intrusive, since the cpu0 device's .of_node field is initially NULL, since this isn't a DT device. Signed-off-by: Guennadi Liakhovetski --- drivers/cpufreq/cpufreq-cpu0.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index ad1fde2..d2ad7b8 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c @@ -12,6 +12,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include #include #include @@ -194,7 +195,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) goto out_put_parent; } - cpu_dev = &pdev->dev; + cpu_dev = get_cpu_device(0); cpu_dev->of_node = np; cpu_reg = devm_regulator_get(cpu_dev, "cpu0"); @@ -289,10 +290,17 @@ static int cpu0_cpufreq_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id cpu0_cpufreq_of_match[] = { + {.compatible = "cpufreq-cpu0"}, + {} +}; +MODULE_DEVICE_TABLE(of, cpu0_cpufreq_of_match); + static struct platform_driver cpu0_cpufreq_platdrv = { .driver = { - .name = "cpufreq-cpu0", - .owner = THIS_MODULE, + .name = "cpufreq-cpu0", + .of_match_table = cpu0_cpufreq_of_match, + .owner = THIS_MODULE, }, .probe = cpu0_cpufreq_probe, .remove = cpu0_cpufreq_remove,