From patchwork Thu Nov 8 01:12:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Turquette X-Patchwork-Id: 12729 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id D510A23E37 for ; Thu, 8 Nov 2012 01:13:35 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 8A46FA18BFE for ; Thu, 8 Nov 2012 01:13:35 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id f6so1520006iag.11 for ; Wed, 07 Nov 2012 17:13:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :mime-version:content-type:x-gm-message-state; bh=4AHrpkBPozMB36kWhXWxznoDJfaFsxc5riWUxLFun1M=; b=DNSt62FHYRJcmDmqrujTSZrIWSTjiXdkRk9j9ZYjZhGwIgCUvb+v7yiece28/b8alI MXuE8zIZk3G5KqL8fyUtSGMTda0pM/TCNEZATCArnvPr3IfHbTi+DHyXJkSI1LHi5vC+ esNfF65YEH5Q2eNc2LAAGJHWATVxrStlWZ94qyBlxbUZVz7Cu0O2rVnLRcvUSEaBXSBS 9eBI14TVTxnQkOGJ3EbgwWfgsQ9jlPEebCgLz0wYlwTSPkkYMDauGzmkonHOctDn2PCF 3b31yq2AgDHbF/EFUZsXI66Impva4mSDRyKYJnOD6tENF+cc/PBx2lsh+k68aQpiApou K3EQ== Received: by 10.43.7.132 with SMTP id oo4mr5773302icb.6.1352337215336; Wed, 07 Nov 2012 17:13:35 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp304328igt; Wed, 7 Nov 2012 17:13:35 -0800 (PST) Received: by 10.60.171.201 with SMTP id aw9mr3149695oec.142.1352337214992; Wed, 07 Nov 2012 17:13:34 -0800 (PST) Received: from arroyo.ext.ti.com (arroyo.ext.ti.com. [192.94.94.40]) by mx.google.com with ESMTPS id mg8si22928505obb.111.2012.11.07.17.13.34 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 07 Nov 2012 17:13:34 -0800 (PST) Received-SPF: pass (google.com: domain of mturquette@ti.com designates 192.94.94.40 as permitted sender) client-ip=192.94.94.40; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mturquette@ti.com designates 192.94.94.40 as permitted sender) smtp.mail=mturquette@ti.com Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id qA81DYlw019052; Wed, 7 Nov 2012 19:13:34 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id qA81DYRb003777; Wed, 7 Nov 2012 19:13:34 -0600 Received: from dlelxv22.itg.ti.com (172.17.1.197) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Wed, 7 Nov 2012 19:13:34 -0600 Received: from nucleus.nsc.com (nucleus.nsc.com [10.188.36.112]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id qA81DPLb015450; Wed, 7 Nov 2012 19:13:33 -0600 From: Mike Turquette To: CC: , , , , Mike Turquette Subject: [PATCH 11/26] ARM: OMAP2+: clock: add OMAP CCF convenience macros to mach-omap2/clock.h Date: Wed, 7 Nov 2012 17:12:46 -0800 Message-ID: <1352337181-29427-12-git-send-email-mturquette@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1352337181-29427-1-git-send-email-mturquette@ti.com> References: <1352337181-29427-1-git-send-email-mturquette@ti.com> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQl7QjzNQrWNPCyRh7wevljLQLdTTdyCfuW5iNX0gWbherQnlOOs5wafDLPhJzH4R6pdFXm4 From: Paul Walmsley Define four convenience macros to be used in the upcoming OMAP2+ common clock framework port. Although the use of these macros will make the data somewhat more difficult to read, they significantly reduce the number of lines in the output patch data. Most of these were created by Rajendra Nayak and Mike Turquette, as far as I know. Signed-off-by: Paul Walmsley Signed-off-by: Mike Turquette [mturquette@ti.com: added DEFINE_CLK_OMAP_HSDIVIDER macro] Cc: Rajendra Nayak --- arch/arm/mach-omap2/clock.h | 77 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index 22555fd..1599f7b 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h @@ -58,6 +58,83 @@ struct omap_clk { struct clockdomain; #define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw) +#define DEFINE_STRUCT_CLK(_name, _parent_array_name, _clkops_name) \ + static struct clk _name = { \ + .name = #_name, \ + .hw = &_name##_hw.hw, \ + .parent_names = _parent_array_name, \ + .num_parents = ARRAY_SIZE(_parent_array_name), \ + .ops = &_clkops_name, \ + }; + +#define DEFINE_STRUCT_CLK_HW_OMAP(_name, _clkdm_name) \ + static struct clk_hw_omap _name##_hw = { \ + .hw = { \ + .clk = &_name, \ + }, \ + .clkdm_name = _clkdm_name, \ + }; + +#define DEFINE_CLK_OMAP_MUX(_name, _clkdm_name, _clksel, \ + _clksel_reg, _clksel_mask, \ + _parent_names, _ops) \ + static struct clk _name; \ + static struct clk_hw_omap _name##_hw = { \ + .hw = { \ + .clk = &_name, \ + }, \ + .clksel = _clksel, \ + .clksel_reg = _clksel_reg, \ + .clksel_mask = _clksel_mask, \ + .clkdm_name = _clkdm_name, \ + }; \ + DEFINE_STRUCT_CLK(_name, _parent_names, _ops); + +#define DEFINE_CLK_OMAP_MUX_GATE(_name, _clkdm_name, _clksel, \ + _clksel_reg, _clksel_mask, \ + _enable_reg, _enable_bit, \ + _hwops, _parent_names, _ops) \ + static struct clk _name; \ + static struct clk_hw_omap _name##_hw = { \ + .hw = { \ + .clk = &_name, \ + }, \ + .ops = _hwops, \ + .enable_reg = _enable_reg, \ + .enable_bit = _enable_bit, \ + .clksel = _clksel, \ + .clksel_reg = _clksel_reg, \ + .clksel_mask = _clksel_mask, \ + .clkdm_name = _clkdm_name, \ + }; \ + DEFINE_STRUCT_CLK(_name, _parent_names, _ops); + +#define DEFINE_CLK_OMAP_HSDIVIDER(_name, _parent_name, \ + _parent_ptr, _flags, \ + _clksel_reg, _clksel_mask) \ + static const struct clksel _name##_div[] = { \ + { \ + .parent = _parent_ptr, \ + .rates = div31_1to31_rates \ + }, \ + { .parent = NULL }, \ + }; \ + static struct clk _name; \ + static const char *_name##_parent_names[] = { \ + _parent_name, \ + }; \ + static struct clk_hw_omap _name##_hw = { \ + .hw = { \ + .clk = &_name, \ + }, \ + .clksel = _name##_div, \ + .clksel_reg = _clksel_reg, \ + .clksel_mask = _clksel_mask, \ + .ops = &clkhwops_omap4_dpllmx, \ + }; \ + DEFINE_STRUCT_CLK(_name, _name##_parent_names, omap_hsdivider_ops); + + #else struct module;