From patchwork Wed Sep 12 04:18:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Warren X-Patchwork-Id: 1440841 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (unknown [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 115D4DF283 for ; Wed, 12 Sep 2012 04:27:53 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TBePw-0001pn-Lh; Wed, 12 Sep 2012 04:19:12 +0000 Received: from avon.wwwdotorg.org ([2001:470:1f0f:bd7::2]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TBePj-0001nv-M5; Wed, 12 Sep 2012 04:19:00 +0000 Received: from severn.wwwdotorg.org (unknown [192.168.65.5]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by avon.wwwdotorg.org (Postfix) with ESMTPS id 1C9F3644E; Tue, 11 Sep 2012 22:19:06 -0600 (MDT) Received: from dart.wifi.foxrun.wwwdotorg.org (unknown [192.168.62.30]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by severn.wwwdotorg.org (Postfix) with ESMTPSA id 9B1FEE47A1; Tue, 11 Sep 2012 22:18:56 -0600 (MDT) From: Stephen Warren To: Arnd Bergmann , Olof Johansson Subject: [PATCH V3 4/5] ARM: bcm2708: add stub clock driver Date: Tue, 11 Sep 2012 22:18:28 -0600 Message-Id: <1347423509-30647-4-git-send-email-swarren@wwwdotorg.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1347423509-30647-1-git-send-email-swarren@wwwdotorg.org> References: <1347423509-30647-1-git-send-email-swarren@wwwdotorg.org> X-NVConfidentiality: public X-Virus-Scanned: clamav-milter 0.96.5 at avon.wwwdotorg.org X-Virus-Status: Clean X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.3 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Chris Boot , Vincent Sanders , Stephen Warren , Simon Arlott , linux-rpi-kernel@lists.infradead.org, Dom Cobley , Russell King , linux-arm-kernel@lists.infradead.org, Dom Cobley X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Simon Arlott This patch adds a minimal stub clock driver for the BCM2708. Its sole purpose is to allow the PL011 AMBA clk_get() API calls to provide something that looks enough like a clock that the driver probes and operates correctly. This patch was extracted from git://github.com/lp0/linux.git branch rpi-split as of 2012/09/08, and modified as follows: * Modified .dev_id for UART clocks to match UART DT node names. Signed-off-by: Chris Boot Signed-off-by: Simon Arlott Signed-off-by: Dom Cobley Signed-off-by: Dom Cobley Signed-off-by: Stephen Warren --- v3: New patch. --- arch/arm/mach-bcm2708/Makefile | 1 + arch/arm/mach-bcm2708/bcm2708.c | 3 +++ arch/arm/mach-bcm2708/clock.c | 53 +++++++++++++++++++++++++++++++++++++++ arch/arm/mach-bcm2708/clock.h | 24 ++++++++++++++++++ 4 files changed, 81 insertions(+) create mode 100644 arch/arm/mach-bcm2708/clock.c create mode 100644 arch/arm/mach-bcm2708/clock.h diff --git a/arch/arm/mach-bcm2708/Makefile b/arch/arm/mach-bcm2708/Makefile index 597f811..4902453 100644 --- a/arch/arm/mach-bcm2708/Makefile +++ b/arch/arm/mach-bcm2708/Makefile @@ -1,2 +1,3 @@ obj-y += bcm2708.o +obj-y += clock.o obj-y += irq.o diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c index 8ee11d9..05a3fc1 100644 --- a/arch/arm/mach-bcm2708/bcm2708.c +++ b/arch/arm/mach-bcm2708/bcm2708.c @@ -22,6 +22,7 @@ #include +#include "clock.h" #include "irq.h" static struct map_desc io_map __initdata = { @@ -40,6 +41,8 @@ void __init bcm2708_init(void) { int ret; + bcm2708_init_clocks(); + ret = of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); if (ret) { diff --git a/arch/arm/mach-bcm2708/clock.c b/arch/arm/mach-bcm2708/clock.c new file mode 100644 index 0000000..83b26ec --- /dev/null +++ b/arch/arm/mach-bcm2708/clock.c @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Broadcom + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include + +#include "clock.h" + +/* + * These are fixed clocks (and device tree doesn't support clk!). + * + * They're probably not all root clocks and it may be possible to + * turn them on and off but until this is mapped out better it's + * the only way they can be used. + */ +DEFINE_CLK_FIXED_RATE(sys_pclk, CLK_IS_ROOT, 250000000, 0); +DEFINE_CLK_FIXED_RATE(apb_pclk, CLK_IS_ROOT, 126000000, 0); +DEFINE_CLK_FIXED_RATE(uart0_pclk, CLK_IS_ROOT, 3000000, 0); +DEFINE_CLK_FIXED_RATE(uart1_pclk, CLK_IS_ROOT, 125000000, 0); + +static struct clk_lookup lookups[] = { + { .con_id = "sys_pclk", .clk = &sys_pclk }, + { .con_id = "apb_pclk", .clk = &apb_pclk }, + { .dev_id = "20201000.uart", .clk = &uart0_pclk }, + { .dev_id = "20215000.uart", .clk = &uart1_pclk } +}; + +void __init bcm2708_init_clocks(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(lookups); i++) { + __clk_init(NULL, lookups[i].clk); + clkdev_add(&lookups[i]); + } +} diff --git a/arch/arm/mach-bcm2708/clock.h b/arch/arm/mach-bcm2708/clock.h new file mode 100644 index 0000000..8670060 --- /dev/null +++ b/arch/arm/mach-bcm2708/clock.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2010 Broadcom + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __BCM2708_CLOCK_H +#define __BCM2708_CLOCK_H + +void __init bcm2708_init_clocks(void); + +#endif