From patchwork Sat Sep 15 06:21:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Warren X-Patchwork-Id: 1461521 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id A1D2E3FC33 for ; Sat, 15 Sep 2012 06:25:25 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TCllG-00038B-0S; Sat, 15 Sep 2012 06:21:50 +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 1TCllA-000379-Ci; Sat, 15 Sep 2012 06:21:45 +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 8F7C5644E; Sat, 15 Sep 2012 00:22:00 -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 A1AFAE47A1; Sat, 15 Sep 2012 00:21:41 -0600 (MDT) From: Stephen Warren To: Arnd Bergmann , Olof Johansson Subject: [PATCH V5 4/5] ARM: bcm2835: add stub clock driver Date: Sat, 15 Sep 2012 00:21:32 -0600 Message-Id: <1347690093-16910-4-git-send-email-swarren@wwwdotorg.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1347690093-16910-1-git-send-email-swarren@wwwdotorg.org> References: <1347690093-16910-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.4 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.5 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 , Mike Turquette , Simon Arlott , Stephen Warren , 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 BCM2835. 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: * s/bcm2708/bcm2835/. * Modified device tree vendor prefix. * Moved implementation to drivers/clk/. * 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 Cc: Mike Turquette Signed-off-by: Stephen Warren --- v5: * No change. v4: * Moved implementation to drivers/clk/. * s/bcm2708/bcm2835/. * Updated for new device tree vendor prefix. v3: * New patch. --- arch/arm/mach-bcm2835/bcm2835.c | 3 +++ drivers/clk/Makefile | 1 + drivers/clk/clk-bcm2835.c | 52 +++++++++++++++++++++++++++++++++++++++ include/linux/clk/bcm2835.h | 24 ++++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 drivers/clk/clk-bcm2835.c create mode 100644 include/linux/clk/bcm2835.h diff --git a/arch/arm/mach-bcm2835/bcm2835.c b/arch/arm/mach-bcm2835/bcm2835.c index e3f2968..f6fea49 100644 --- a/arch/arm/mach-bcm2835/bcm2835.c +++ b/arch/arm/mach-bcm2835/bcm2835.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -38,6 +39,8 @@ void __init bcm2835_init(void) { int ret; + bcm2835_init_clocks(); + ret = of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); if (ret) { diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index 5869ea3..d5c19d1 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -3,6 +3,7 @@ obj-$(CONFIG_CLKDEV_LOOKUP) += clkdev.o obj-$(CONFIG_COMMON_CLK) += clk.o clk-fixed-rate.o clk-gate.o \ clk-mux.o clk-divider.o clk-fixed-factor.o # SoCs specific +obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o obj-$(CONFIG_ARCH_NOMADIK) += clk-nomadik.o obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o obj-$(CONFIG_ARCH_MXS) += mxs/ diff --git a/drivers/clk/clk-bcm2835.c b/drivers/clk/clk-bcm2835.c new file mode 100644 index 0000000..148ac35 --- /dev/null +++ b/drivers/clk/clk-bcm2835.c @@ -0,0 +1,52 @@ +/* + * 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 + +/* + * 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 bcm2835_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/include/linux/clk/bcm2835.h b/include/linux/clk/bcm2835.h new file mode 100644 index 0000000..aa937f6 --- /dev/null +++ b/include/linux/clk/bcm2835.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 __LINUX_CLK_BCM2835_H_ +#define __LINUX_CLK_BCM2835_H_ + +void __init bcm2835_init_clocks(void); + +#endif