From patchwork Thu May 29 22:40:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 4267801 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 A2E05BEEA7 for ; Thu, 29 May 2014 22:43:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B5B1A20122 for ; Thu, 29 May 2014 22:43:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D21AB2011B for ; Thu, 29 May 2014 22:43:36 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wq91G-00008I-6k; Thu, 29 May 2014 22:41:54 +0000 Received: from mail-ob0-x230.google.com ([2607:f8b0:4003:c01::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wq90l-0008MV-L7 for linux-arm-kernel@lists.infradead.org; Thu, 29 May 2014 22:41:24 +0000 Received: by mail-ob0-f176.google.com with SMTP id wo20so1023186obc.35 for ; Thu, 29 May 2014 15:41:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EMaMxQS6NfZkQbymLauq/1+xnsSUFz9Evcw+kp4fnWU=; b=lP1MmHK8V/++dGtsK0poz0S38o9c/Z3CtwySoJ5NXFRuITelqd+zb5lrcTlFhr2xLr YteE+JbKFQBIcsJ6LyeSPcHPzdUpJWck1IgvxFfEJYgr5JXB3P+1B73mXmgyF8xgy3D3 SK6A9iIygauXX3VArhAQ8v9+IGyQH752b7trkx3PV2vmHNh2ST0MkSdugX7hHyjlywJw 34ivw5mpDPdwqcZc+dMt/O3SfAGyilP7Z63RGTDDfhpi/lXYkYESJ1yWeD71w6/snJAu IY5eb2yrA/Ohb15QoA0NdABr++7oTEeCs7Nz6NAwY4SV10oxCliHmIDP6DWzq/95cq58 DNFA== X-Received: by 10.182.58.83 with SMTP id o19mr12594258obq.26.1401403261503; Thu, 29 May 2014 15:41:01 -0700 (PDT) Received: from localhost.localdomain (66-90-144-10.dyn.grandenetworks.net. [66.90.144.10]) by mx.google.com with ESMTPSA id tz6sm3528543obc.10.2014.05.29.15.40.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 May 2014 15:40:59 -0700 (PDT) From: Rob Herring To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org Subject: [PATCH v2 11/11] clk: versatile: add versatile OSC support Date: Thu, 29 May 2014 17:40:21 -0500 Message-Id: <1401403221-27523-12-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1401403221-27523-1-git-send-email-robherring2@gmail.com> References: <1401403221-27523-1-git-send-email-robherring2@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140529_154123_752772_EF26AFF1 X-CRM114-Status: GOOD ( 14.05 ) X-Spam-Score: 0.1 (/) Cc: Rob Herring , Linus Walleij , arm@kernel.org, Mike Turquette 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=-2.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 From: Rob Herring Versatile platforms share the same OSC programming model as Integrator platforms. Add the necessary parameters and init functions for Versatile. Renaming the file to clk-versatile.c as versatile is used as the family name for ARM, Ltd. boards. Signed-off-by: Rob Herring Cc: Mike Turquette Acked-by: Arnd Bergmann Reviewed-by: Linus Walleij Acked-by: Mike Turquette --- v2: - Rename clk-integrator.c to clk-versatile.c drivers/clk/versatile/Makefile | 3 +- .../{clk-integrator.c => clk-versatile.c} | 35 ++++++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) rename drivers/clk/versatile/{clk-integrator.c => clk-versatile.c} (66%) diff --git a/drivers/clk/versatile/Makefile b/drivers/clk/versatile/Makefile index c16ca78..9ee2b37 100644 --- a/drivers/clk/versatile/Makefile +++ b/drivers/clk/versatile/Makefile @@ -1,6 +1,5 @@ # Makefile for Versatile-specific clocks -obj-$(CONFIG_ICST) += clk-icst.o -obj-$(CONFIG_ARCH_INTEGRATOR) += clk-integrator.o +obj-$(CONFIG_ICST) += clk-icst.o clk-versatile.o obj-$(CONFIG_INTEGRATOR_IMPD1) += clk-impd1.o obj-$(CONFIG_ARCH_REALVIEW) += clk-realview.o obj-$(CONFIG_ARCH_VEXPRESS) += clk-vexpress.o clk-sp810.o diff --git a/drivers/clk/versatile/clk-integrator.c b/drivers/clk/versatile/clk-versatile.c similarity index 66% rename from drivers/clk/versatile/clk-integrator.c rename to drivers/clk/versatile/clk-versatile.c index 734c4b8..fe52a79 100644 --- a/drivers/clk/versatile/clk-integrator.c +++ b/drivers/clk/versatile/clk-versatile.c @@ -17,6 +17,9 @@ #define INTEGRATOR_HDR_LOCK_OFFSET 0x14 +#define VERSATILE_SYS_OSCCLCD_OFFSET 0x1c +#define VERSATILE_SYS_LOCK_OFFSET 0x20 + /* Base offset for the core module */ static void __iomem *cm_base; @@ -37,11 +40,27 @@ static const struct clk_icst_desc __initdata cm_auxosc_desc = { .lock_offset = INTEGRATOR_HDR_LOCK_OFFSET, }; -static void __init of_integrator_cm_osc_setup(struct device_node *np) +static const struct icst_params versatile_auxosc_params = { + .vco_max = ICST307_VCO_MAX, + .vco_min = ICST307_VCO_MIN, + .vd_min = 4 + 8, + .vd_max = 511 + 8, + .rd_min = 1 + 2, + .rd_max = 127 + 2, + .s2div = icst307_s2div, + .idx2s = icst307_idx2s, +}; + +static const struct clk_icst_desc versatile_auxosc_desc __initconst = { + .params = &versatile_auxosc_params, + .vco_offset = VERSATILE_SYS_OSCCLCD_OFFSET, + .lock_offset = VERSATILE_SYS_LOCK_OFFSET, +}; +static void __init cm_osc_setup(struct device_node *np, + const struct clk_icst_desc *desc) { struct clk *clk = ERR_PTR(-EINVAL); const char *clk_name = np->name; - const struct clk_icst_desc *desc = &cm_auxosc_desc; const char *parent_name; if (!cm_base) { @@ -65,5 +84,17 @@ static void __init of_integrator_cm_osc_setup(struct device_node *np) if (!IS_ERR(clk)) of_clk_add_provider(np, of_clk_src_simple_get, clk); } + +static void __init of_integrator_cm_osc_setup(struct device_node *np) +{ + cm_osc_setup(np, &cm_auxosc_desc); +} CLK_OF_DECLARE(integrator_cm_auxosc_clk, "arm,integrator-cm-auxosc", of_integrator_cm_osc_setup); + +static void __init of_versatile_cm_osc_setup(struct device_node *np) +{ + cm_osc_setup(np, &versatile_auxosc_desc); +} +CLK_OF_DECLARE(versatile_cm_auxosc_clk, + "arm,versatile-cm-auxosc", of_versatile_cm_osc_setup);