From patchwork Wed Mar 23 02:18:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Feng Xiao X-Patchwork-Id: 8646801 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 193F3C0553 for ; Wed, 23 Mar 2016 02:22:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 262772038A for ; Wed, 23 Mar 2016 02:22:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1B7BA2037F for ; Wed, 23 Mar 2016 02:21:59 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aiYPC-0004dW-2W; Wed, 23 Mar 2016 02:20:18 +0000 Received: from regular1.263xmail.com ([211.150.99.132]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aiYP8-0003OT-91; Wed, 23 Mar 2016 02:20:15 +0000 Received: from xf?rock-chips.com (unknown [192.168.167.228]) by regular1.263xmail.com (Postfix) with SMTP id 59535911F; Wed, 23 Mar 2016 10:19:48 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 8B21CC39; Wed, 23 Mar 2016 10:19:45 +0800 (CST) X-RL-SENDER: xf@rock-chips.com X-FST-TO: linux@arm.linux.org.uk X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: xf@rock-chips.com X-UNIQUE-TAG: <2a2a2f9964f0516043ce96d4418be471> X-ATTACHMENT-NUM: 0 X-SENDER: xf@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 28256WS8H25; Wed, 23 Mar 2016 10:19:47 +0800 (CST) From: Feng Xiao To: linux@arm.linux.org.uk, heiko@sntech.de, rjw@rjwysocki.net, viresh.kumar@linaro.org Subject: [PATCH v2] cpufreq: rockchip: add driver Date: Wed, 23 Mar 2016 10:18:07 +0800 Message-Id: <1458699487-58470-1-git-send-email-xf@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1458647848-48999-1-git-send-email-xf@rock-chips.com> References: <1458647848-48999-1-git-send-email-xf@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160322_192014_790017_78E5F23C X-CRM114-Status: GOOD ( 17.18 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: huangtao@rock-chips.com, tim.chen@rock-chips.com, linux-pm@vger.kernel.org, xxx@rock-chips.com, Feng Xiao , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, zyw@rock-chips.com, jay.xu@rock-chips.com, linux-arm-kernel@lists.infradead.org, wxt@rock-chips.com MIME-Version: 1.0 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, 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 This driver will directly use cpufreq-dt driver as backend. As there is not a generic devicetree board file(rockchip.c) on ARM64 architecture, so remove platform_device_register_simple in rockchip.c and add a new cpufreq driver to support Rockchip SoCs. Signed-off-by: Feng Xiao Reviewed-by: Heiko Stuebner --- change in v2: - add rockchip,rk3036 and rockchip,rk3228 to compatibility list change in v1: - add compatible check arch/arm/mach-rockchip/rockchip.c | 1 - drivers/cpufreq/Kconfig.arm | 10 +++++++ drivers/cpufreq/Makefile | 1 + drivers/cpufreq/rockchip-cpufreq.c | 57 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 drivers/cpufreq/rockchip-cpufreq.c diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c index 3f07cc5..beb71da 100644 --- a/arch/arm/mach-rockchip/rockchip.c +++ b/arch/arm/mach-rockchip/rockchip.c @@ -74,7 +74,6 @@ static void __init rockchip_dt_init(void) { rockchip_suspend_init(); of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); - platform_device_register_simple("cpufreq-dt", 0, NULL, 0); } static const char * const rockchip_board_dt_compat[] = { diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index 14b1f93..1786315 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm @@ -97,6 +97,16 @@ config ARM_OMAP2PLUS_CPUFREQ depends on ARCH_OMAP2PLUS default ARCH_OMAP2PLUS +config ARM_ROCKCHIP_CPUFREQ + tristate "Rockchip CPUfreq driver" + depends on ARCH_ROCKCHIP && CPUFREQ_DT + select PM_OPP + help + This adds the CPUFreq driver support for Rockchip SoCs. + The driver will directly use cpufreq-dt driver as backend. + + If in doubt, say N. + config ARM_S3C_CPUFREQ bool help diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile index 9e63fb1..91d8bb7 100644 --- a/drivers/cpufreq/Makefile +++ b/drivers/cpufreq/Makefile @@ -61,6 +61,7 @@ obj-$(CONFIG_ARM_MT8173_CPUFREQ) += mt8173-cpufreq.o obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ) += omap-cpufreq.o obj-$(CONFIG_ARM_PXA2xx_CPUFREQ) += pxa2xx-cpufreq.o obj-$(CONFIG_PXA3xx) += pxa3xx-cpufreq.o +obj-$(CONFIG_ARM_ROCKCHIP_CPUFREQ) += rockchip-cpufreq.o obj-$(CONFIG_ARM_S3C24XX_CPUFREQ) += s3c24xx-cpufreq.o obj-$(CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS) += s3c24xx-cpufreq-debugfs.o obj-$(CONFIG_ARM_S3C2410_CPUFREQ) += s3c2410-cpufreq.o diff --git a/drivers/cpufreq/rockchip-cpufreq.c b/drivers/cpufreq/rockchip-cpufreq.c new file mode 100644 index 0000000..9266614 --- /dev/null +++ b/drivers/cpufreq/rockchip-cpufreq.c @@ -0,0 +1,57 @@ +/* + * Rockchip Platforms CPUFreq Support + * + * Copyright (C) 2016 Fuzhou Rockchip Electronics Co., Ltd + * + * Feng Xiao + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include + +static const char * const rockchip_compat[] = { + "rockchip,rk2928", + "rockchip,rk3036", + "rockchip,rk3066a", + "rockchip,rk3066b", + "rockchip,rk3188", + "rockchip,rk3228", + "rockchip,rk3288", + "rockchip,rk3366", + "rockchip,rk3368", + "rockchip,rk3399", +}; + +static int __init rockchip_cpufreq_driver_init(void) +{ + struct platform_device *pdev; + int i; + + for (i = 0; i < ARRAY_SIZE(rockchip_compat); i++) { + if (of_machine_is_compatible(rockchip_compat[i])) { + pdev = platform_device_register_simple("cpufreq-dt", + -1, NULL, 0); + return PTR_ERR_OR_ZERO(pdev); + } + } + + return -ENODEV; +} +module_init(rockchip_cpufreq_driver_init); + +MODULE_AUTHOR("Feng Xiao "); +MODULE_DESCRIPTION("Rockchip cpufreq driver"); +MODULE_LICENSE("GPL v2");