From patchwork Wed Oct 23 13:04: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: 3088441 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4F7EDBF924 for ; Wed, 23 Oct 2013 13:11:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 297F82039C for ; Wed, 23 Oct 2013 13:11:13 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4DB5C203AD for ; Wed, 23 Oct 2013 13:11:08 +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 1VYyCg-0004Ec-Is; Wed, 23 Oct 2013 13:10:26 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYyCO-0005ze-Rs; Wed, 23 Oct 2013 13:10:08 +0000 Received: from vps0.lunn.ch ([178.209.37.122]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYyC6-0005wu-Li for linux-arm-kernel@lists.infradead.org; Wed, 23 Oct 2013 13:09:57 +0000 Received: from lunn by vps0.lunn.ch with local (Exim 4.80) (envelope-from ) id 1VYy6s-000851-Un; Wed, 23 Oct 2013 15:04:26 +0200 From: Andrew Lunn To: Sebastian Hesselbarth , Jason Cooper , rjw@rjwysocki.net, viresh.kumar@linaro.org Subject: [PATCH 2/4] mvebu: Dove: Instantiate cpufreq driver. Date: Wed, 23 Oct 2013 15:04:19 +0200 Message-Id: <1382533461-31021-2-git-send-email-andrew@lunn.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1382533461-31021-1-git-send-email-andrew@lunn.ch> References: <1382533461-31021-1-git-send-email-andrew@lunn.ch> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131023_090956_738340_D6134FE5 X-CRM114-Status: GOOD ( 13.59 ) X-Spam-Score: -2.3 (--) Cc: Andrew Lunn , linux ARM , linux-pm@vger.kernel.org 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: , 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.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 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 | 2 ++ 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, 41 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 1ad6fb6..7744415 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -495,6 +495,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 49f72a8..98202de 100644 --- a/arch/arm/mach-dove/board-dt.c +++ b/arch/arm/mach-dove/board-dt.c @@ -70,6 +70,8 @@ static void __init dove_dt_init(void) /* Setup clocks for legacy devices */ dove_legacy_clk_init(); + dove_cpufreq_init(); + /* Internal devices not ported to DT yet */ dove_pcie_init(1, 1); diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c index c122bcf..323fcd4 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 1d72522..5c9a77b 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 0c4b35f..48db186 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)