From patchwork Tue Jun 3 12:02:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gaku Inami X-Patchwork-Id: 4287921 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 DFA51BEEA7 for ; Tue, 3 Jun 2014 12:07:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DF37E202A1 for ; Tue, 3 Jun 2014 12:07:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AAF062027D for ; Tue, 3 Jun 2014 12:07:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753198AbaFCMG6 (ORCPT ); Tue, 3 Jun 2014 08:06:58 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:65021 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752736AbaFCMG4 (ORCPT ); Tue, 3 Jun 2014 08:06:56 -0400 Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie3.idc.renesas.com with ESMTP; 03 Jun 2014 21:06:55 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id C62B34B5A4; Tue, 3 Jun 2014 21:06:55 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id C917E480A6; Tue, 3 Jun 2014 21:06:55 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id C482A480A7; Tue, 3 Jun 2014 21:06:55 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac4.idc.renesas.com with ESMTP id XAC29031; Tue, 3 Jun 2014 21:06:55 +0900 X-IronPort-AV: E=Sophos;i="4.98,964,1392130800"; d="scan'208";a="162257323" Received: from mail-sg1lp0092.outbound.protection.outlook.com (HELO APAC01-SG1-obe.outbound.protection.outlook.com) ([207.46.51.92]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES128-SHA; 03 Jun 2014 21:06:52 +0900 Received: from [10.164.207.238] (211.11.155.149) by SINPR06MB379.apcprd06.prod.outlook.com (10.141.116.26) with Microsoft SMTP Server (TLS) id 15.0.954.9; Tue, 3 Jun 2014 12:06:51 +0000 Message-ID: <538DB965.7030806@bp.renesas.com> Date: Tue, 3 Jun 2014 21:02:45 +0900 From: Gaku Inami User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Linux-sh list CC: Magnus Damm , Simon Horman , Benoit Cousson Subject: [PATCH v2 4/8] ARM: shmobile: add cpufreq-cpu0 driver for common SH-Mobile X-Originating-IP: [211.11.155.149] X-ClientProxiedBy: SINPR04CA015.apcprd04.prod.outlook.com (10.141.109.35) To SINPR06MB379.apcprd06.prod.outlook.com (10.141.116.26) X-Microsoft-Antispam: BL:0; ACTION:Default; RISK:Low; SCL:0; SPMLVL:NotSpam; PCL:0; RULEID: X-Forefront-PRVS: 02318D10FB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(6009001)(6049001)(428001)(22564002)(199002)(189002)(79102001)(4396001)(42186004)(65806001)(81342001)(77982001)(59896001)(81542001)(76482001)(65956001)(46102001)(66066001)(80022001)(47776003)(64706001)(20776003)(50466002)(54356999)(87266999)(65816999)(101416001)(83072002)(50986999)(85852003)(19580395003)(83322001)(19580405001)(83506001)(21056001)(74662001)(31966008)(99396002)(92726001)(92566001)(74502001)(575784001)(86362001)(33656002)(23736002)(87976001)(218763003); DIR:OUT; SFP:; SCL:1; SRVR:SINPR06MB379; H:[10.164.207.238]; FPR:; MLV:sfv; PTR:InfoNoRecords; A:0; MX:1; LANG:en; Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=gaku.inami.xw@bp.renesas.com; X-OriginatorOrg: bp.renesas.com Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, 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 I add a new file(cpufreq.c) for the following reasons. - Registration of platform_device must be unified in SH-Mobile. - We can't create a node of cpufreq drivers into device tree. (Because cpufreq driver is virtual device.) Signed-off-by: Gaku Inami --- Changes since version 1: - changed the method of checking the device tree. arch/arm/mach-shmobile/Makefile | 1 + arch/arm/mach-shmobile/cpufreq.c | 31 ++++++++++++++++++++++++++ arch/arm/mach-shmobile/include/mach/common.h | 7 ++++++ 3 files changed, 39 insertions(+) create mode 100644 arch/arm/mach-shmobile/cpufreq.c diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile index 29034aa..ccb0563 100644 --- a/arch/arm/mach-shmobile/Makefile +++ b/arch/arm/mach-shmobile/Makefile @@ -48,6 +48,7 @@ obj-$(CONFIG_ARCH_SH7372) += entry-intc.o # PM objects obj-$(CONFIG_SUSPEND) += suspend.o obj-$(CONFIG_CPU_IDLE) += cpuidle.o +obj-$(CONFIG_CPU_FREQ) += cpufreq.o obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o pm-rmobile.o obj-$(CONFIG_ARCH_SH73A0) += pm-sh73a0.o obj-$(CONFIG_ARCH_R8A7740) += pm-r8a7740.o pm-rmobile.o diff --git a/arch/arm/mach-shmobile/cpufreq.c b/arch/arm/mach-shmobile/cpufreq.c new file mode 100644 index 0000000..e2c868f --- /dev/null +++ b/arch/arm/mach-shmobile/cpufreq.c @@ -0,0 +1,31 @@ +/* + * CPUFreq support code for SH-Mobile ARM + * + * Copyright (C) 2014 Gaku Inami + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ + +#include +#include +#include + +int __init shmobile_cpufreq_init(void) +{ + struct device_node *np; + + np = of_cpu_device_node_get(0); + if (np == NULL) { + pr_err("failed to find cpu0 node\n"); + return 0; + } + + if (of_get_property(np, "operating-points", NULL)) + platform_device_register_simple("cpufreq-cpu0", -1, NULL, 0); + + of_node_put(np); + + return 0; +} diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h index 8f0cd57..ab5a9b2 100644 --- a/arch/arm/mach-shmobile/include/mach/common.h +++ b/arch/arm/mach-shmobile/include/mach/common.h @@ -47,12 +47,19 @@ int shmobile_cpuidle_init(void); static inline int shmobile_cpuidle_init(void) { return 0; } #endif +#ifdef CONFIG_CPU_FREQ +int shmobile_cpufreq_init(void); +#else +static inline int shmobile_cpufreq_init(void) { return 0; } +#endif + extern void __iomem *shmobile_scu_base; static inline void __init shmobile_init_late(void) { shmobile_suspend_init(); shmobile_cpuidle_init(); + shmobile_cpufreq_init(); } #endif /* __ARCH_MACH_COMMON_H */