From patchwork Wed Dec 4 14:17:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 3282741 Return-Path: X-Original-To: patchwork-linux-pm@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 A56BDC0D4A for ; Wed, 4 Dec 2013 14:18:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01B8720218 for ; Wed, 4 Dec 2013 14:17:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C4642022D for ; Wed, 4 Dec 2013 14:17:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932448Ab3LDORp (ORCPT ); Wed, 4 Dec 2013 09:17:45 -0500 Received: from vps0.lunn.ch ([178.209.37.122]:56581 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932358Ab3LDORp (ORCPT ); Wed, 4 Dec 2013 09:17:45 -0500 Received: from lunn by vps0.lunn.ch with local (Exim 4.80) (envelope-from ) id 1VoDGk-0001yu-Oi; Wed, 04 Dec 2013 15:17:38 +0100 From: Andrew Lunn To: rjw@rjwysocki.net, viresh.kumar@linaro.org, Jason Cooper , Sebastian Hesselbarth Cc: linux-pm@vger.kernel.org, linux ARM , Andrew Lunn Subject: [PATCH v4 2/4] mvebu: Dove: Instantiate cpufreq driver. Date: Wed, 4 Dec 2013 15:17:19 +0100 Message-Id: <1386166641-7567-3-git-send-email-andrew@lunn.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386166641-7567-1-git-send-email-andrew@lunn.ch> References: <1386166641-7567-1-git-send-email-andrew@lunn.ch> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 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 Add a platform driver definition to instantiate the dove cpufreq driver. Also indicate the ARCH has cpufreq support, so allowing the cpufreq framework to be enabled. Signed-off-by: Andrew Lunn Tested-by: Sebastian Hesselbarth --- Make resource names consistent. Fix length of ranges --- arch/arm/Kconfig | 1 + arch/arm/mach-dove/board-dt.c | 3 +++ arch/arm/mach-dove/common.c | 36 ++++++++++++++++++++++++++++++++++ arch/arm/mach-dove/common.h | 1 + arch/arm/mach-dove/include/mach/dove.h | 1 + 5 files changed, 42 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index c1f1a7eee953..908b02f8d901 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -500,6 +500,7 @@ config ARCH_IXP4XX config ARCH_DOVE bool "Marvell Dove" + select ARCH_HAS_CPUFREQ select ARCH_REQUIRE_GPIOLIB select CPU_PJ4 select GENERIC_CLOCKEVENTS diff --git a/arch/arm/mach-dove/board-dt.c b/arch/arm/mach-dove/board-dt.c index 49fa9abd09da..845e8b328432 100644 --- a/arch/arm/mach-dove/board-dt.c +++ b/arch/arm/mach-dove/board-dt.c @@ -27,6 +27,9 @@ static void __init dove_dt_init(void) tauros2_init(0); #endif BUG_ON(mvebu_mbus_dt_init()); + + dove_cpufreq_init(); + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c index c122bcff9f7c..323fcd4b27b6 100644 --- a/arch/arm/mach-dove/common.c +++ b/arch/arm/mach-dove/common.c @@ -344,6 +344,42 @@ void __init dove_sdio1_init(void) platform_device_register(&dove_sdio1); } +/***************************************************************************** + * CPU Frequency + ****************************************************************************/ +static struct resource dove_cpufreq_resources[] = { + [0] = { + .start = DOVE_PMU_PHYS_BASE, + .end = DOVE_PMU_PHYS_BASE + 0x7, + .flags = IORESOURCE_MEM, + .name = "cpufreq: DFS" + }, + [1] = { + .start = DOVE_PMU_PHYS_BASE + 0x8000, + .end = DOVE_PMU_PHYS_BASE + 0x8003, + .flags = IORESOURCE_MEM, + .name = "cpufreq: PMU CR" + }, + [2] = { + .start = DOVE_PMU_PHYS_BASE + 0x0044, + .end = DOVE_PMU_PHYS_BASE + 0x0047, + .flags = IORESOURCE_MEM, + .name = "cpufreq: PMU Clk Div" + }, +}; + +static struct platform_device dove_cpufreq_device = { + .name = "dove-cpufreq", + .id = -1, + .num_resources = ARRAY_SIZE(dove_cpufreq_resources), + .resource = dove_cpufreq_resources, +}; + +void __init dove_cpufreq_init(void) +{ + platform_device_register(&dove_cpufreq_device); +} + void __init dove_setup_cpu_wins(void) { /* diff --git a/arch/arm/mach-dove/common.h b/arch/arm/mach-dove/common.h index 1d725224d146..5c9a77bdd442 100644 --- a/arch/arm/mach-dove/common.h +++ b/arch/arm/mach-dove/common.h @@ -44,6 +44,7 @@ void dove_spi1_init(void); void dove_i2c_init(void); void dove_sdio0_init(void); void dove_sdio1_init(void); +void dove_cpufreq_init(void); void dove_restart(enum reboot_mode, const char *); #endif diff --git a/arch/arm/mach-dove/include/mach/dove.h b/arch/arm/mach-dove/include/mach/dove.h index 0c4b35f4ee5b..48db186ae6bc 100644 --- a/arch/arm/mach-dove/include/mach/dove.h +++ b/arch/arm/mach-dove/include/mach/dove.h @@ -144,6 +144,7 @@ #define DOVE_SD0_GPIO_SEL (1 << 0) /* Power Management */ +#define DOVE_PMU_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0xd0000) #define DOVE_PMU_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xd0000) #define DOVE_PMU_SIG_CTRL (DOVE_PMU_VIRT_BASE + 0x802c)