From patchwork Sun Oct 14 22:14:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Domenico Andreoli X-Patchwork-Id: 1591831 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 6BFE7E00AD for ; Sun, 14 Oct 2012 22:33:00 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TNWiJ-0000gQ-A9; Sun, 14 Oct 2012 22:31:15 +0000 Received: from mail-we0-f177.google.com ([74.125.82.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TNWhb-0000V7-A2 for linux-arm-kernel@lists.infradead.org; Sun, 14 Oct 2012 22:30:34 +0000 Received: by mail-we0-f177.google.com with SMTP id u50so2855537wey.36 for ; Sun, 14 Oct 2012 15:30:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:user-agent:date:from:to:cc:subject:references :content-disposition; bh=5+UnytfNxkrF6zBL6B6aSkzs5XOU1lXYHQah1w43z6Y=; b=ZQMQ0hq7BuAfkAvpI2DeTHJ73Rck7KSuvCgCEIavA1gPKNdq5GQoXq2mt4tNq1RALo +20tQW4X6ZTS0XJBZnAf6JK4X/yYj7SzROdsXU2TYAp2uNcm6YcDNYQ/6FoPp0mO+R6T 1pveEGwiVhje2pydKPcir3zL4RUa2QbTGfQOg0V2NeK9HAaPX+BLwGmg3xhFvZqJKRjQ vl78GpP77CKUHtzTghb9BDmC5nzJfWE2DXLiNlC9sp2A9fuC+K2Ce5H6c0QDbHHtyqbW 8dCCe80BsrlhSbfo4uAfwOHnW7j9RgKQs2KL6voyXjWb3ru5pyt9RLUWRxVSEb9vobeq WuQA== Received: by 10.180.99.194 with SMTP id es2mr19309651wib.15.1350253829011; Sun, 14 Oct 2012 15:30:29 -0700 (PDT) Received: from raptus.dandreoli.com (178-85-163-250.dynamic.upc.nl. [178.85.163.250]) by mx.google.com with ESMTPS id b3sm10900001wie.0.2012.10.14.15.30.26 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 14 Oct 2012 15:30:27 -0700 (PDT) Received: by raptus.dandreoli.com (Postfix, from userid 1000) id 1A0503F620B; Mon, 15 Oct 2012 00:30:25 +0200 (CEST) Message-Id: <20121014223024.818915781@gmail.com> User-Agent: quilt/0.60-1 Date: Mon, 15 Oct 2012 00:14:54 +0200 From: Domenico Andreoli To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 4/5] ARM: bcm476x: Add stub clock driver References: <20121014221450.866288977@gmail.com> Content-Disposition: inline; filename=arm-bcm476x-add-stub-clock-driver.patch X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.177 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (cavokz[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Domenico Andreoli , Olof Johansson 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: Domenico Andreoli Minimal clock support required for the boot, a more complete implementation will follow (shortly). v2: * dropped the static clock initializers in favour of clk_register_fixed_rate() v1: * initial release Signed-off-by: Domenico Andreoli Acked-by: Olof Johansson --- arch/arm/mach-bcm476x/bcm476x.c | 3 ++ drivers/clk/Makefile | 1 + drivers/clk/clk-bcm476x.c | 55 ++++++++++++++++++++++++++++++++++++++++ include/linux/clk/bcm476x.h | 22 ++++++++++++++++ 4 files changed, 81 insertions(+) create mode 100644 drivers/clk/clk-bcm476x.c create mode 100644 include/linux/clk/bcm476x.h Index: b/arch/arm/mach-bcm476x/bcm476x.c =================================================================== --- a/arch/arm/mach-bcm476x/bcm476x.c +++ b/arch/arm/mach-bcm476x/bcm476x.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -43,6 +44,8 @@ static void __init bcm476x_init(void) { int err; + bcm476x_init_clocks(); + err = of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); if (err) { pr_err("of_platform_populate failed: %d\n", err); Index: b/drivers/clk/Makefile =================================================================== --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -5,6 +5,7 @@ obj-$(CONFIG_COMMON_CLK) += clk.o clk-fi clk-mux.o clk-divider.o clk-fixed-factor.o # SoCs specific obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o +obj-$(CONFIG_ARCH_BCM476X) += clk-bcm476x.o obj-$(CONFIG_ARCH_NOMADIK) += clk-nomadik.o obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o obj-$(CONFIG_ARCH_MXS) += mxs/ Index: b/drivers/clk/clk-bcm476x.c =================================================================== --- /dev/null +++ b/drivers/clk/clk-bcm476x.c @@ -0,0 +1,55 @@ +/* + * Broadcom BCM476x SoCs clocks + * + * Copyright (C) 2011-2012 Domenico Andreoli + * + * 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. + */ + +#include +#include +#include + +/* + * These are fixed clocks. 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. + */ +void __init bcm476x_init_clocks(void) +{ + struct clk *clk; + + clk = clk_register_fixed_rate(NULL, "sys_pclk", NULL, CLK_IS_ROOT, 312000000); + if (IS_ERR(clk)) + pr_err("sys_pclk not registered\n"); + + clk = clk_register_fixed_rate(NULL, "apb_pclk", NULL, CLK_IS_ROOT, 156000000); + if (IS_ERR(clk)) + pr_err("apb_pclk not registered\n"); + + clk = clk_register_fixed_rate(NULL, "uart0_pclk", NULL, CLK_IS_ROOT, 78000000); + if (IS_ERR(clk)) + pr_err("uart0_pclk not registered\n"); + if (clk_register_clkdev(clk, NULL, "c0000.uart0")) + pr_err("uart0_pclk alias not registered\n"); + + clk = clk_register_fixed_rate(NULL, "uart1_pclk", NULL, CLK_IS_ROOT, 78000000); + if (IS_ERR(clk)) + pr_err("uart1_pclk not registered\n"); + if (clk_register_clkdev(clk, NULL, "c1000.uart1")) + pr_err("uart1_pclk alias not registered\n"); + + clk = clk_register_fixed_rate(NULL, "uart2_pclk", NULL, CLK_IS_ROOT, 78000000); + if (IS_ERR(clk)) + pr_err("uart2_pclk not registered\n"); + if (clk_register_clkdev(clk, NULL, "b2000.uart2")) + pr_err("uart2_pclk alias not registered\n"); +} Index: b/include/linux/clk/bcm476x.h =================================================================== --- /dev/null +++ b/include/linux/clk/bcm476x.h @@ -0,0 +1,22 @@ +/* + * Broadcom BCM476x SoCs clocks + * + * Copyright (C) 2011-2012 Domenico Andreoli + * + * 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. + */ + +#ifndef _LINUX_CLK_BCM476X_H +#define _LINUX_CLK_BCM476X_H + +void __init bcm476x_init_clocks(void); + +#endif