From patchwork Fri Oct 25 15:57:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 3096631 Return-Path: X-Original-To: patchwork-linux-omap@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 E2916BF924 for ; Fri, 25 Oct 2013 16:01:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4248420233 for ; Fri, 25 Oct 2013 16:01:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1CC7320222 for ; Fri, 25 Oct 2013 16:01:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753866Ab3JYQBA (ORCPT ); Fri, 25 Oct 2013 12:01:00 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:41076 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751459Ab3JYQA7 (ORCPT ); Fri, 25 Oct 2013 12:00:59 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r9PFxfC2027812; Fri, 25 Oct 2013 10:59:41 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id r9PFxemq013064; Fri, 25 Oct 2013 10:59:40 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.2.342.3; Fri, 25 Oct 2013 10:59:41 -0500 Received: from sokoban.tieu.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id r9PFvrt1032569; Fri, 25 Oct 2013 10:59:38 -0500 From: Tero Kristo To: , , , , , , CC: , Subject: [PATCHv9 34/43] ARM: OMAP2+: clock: add support for regmap Date: Fri, 25 Oct 2013 18:57:28 +0300 Message-ID: <1382716658-6964-35-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1382716658-6964-1-git-send-email-t-kristo@ti.com> References: <1382716658-6964-1-git-send-email-t-kristo@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 Using regmap is required for isolating the actual memory access from the clock code. Now, the driver providing the support for the clock IP block can provide a regmap for this purpose. Signed-off-by: Tero Kristo --- arch/arm/mach-omap2/clock.c | 20 ++++++++++++++++++++ arch/arm/mach-omap2/clock.h | 3 +++ 2 files changed, 23 insertions(+) diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index 223f432b..560c49b 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c @@ -57,6 +57,26 @@ static bool clkdm_control = true; static LIST_HEAD(clk_hw_omap_clocks); +void omap2_clk_writel(u32 val, struct clk_hw_omap *clk, void __iomem *reg) +{ + if (clk->regmap) + regmap_write(clk->regmap, (u32)reg, val); + else + __raw_writel(val, reg); +} + +u32 omap2_clk_readl(struct clk_hw_omap *clk, void __iomem *reg) +{ + u32 val; + + if (clk->regmap) + regmap_read(clk->regmap, (u32)reg, &val); + else + val = __raw_readl(reg); + + return val; +} + /* * Used for clocks that have the same value as the parent clock, * divided by some factor diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index d1b227e..a166683 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h @@ -252,6 +252,9 @@ void omap2_clk_print_new_rates(const char *hfclkin_ck_name, const char *core_ck_name, const char *mpu_ck_name); +u32 omap2_clk_readl(struct clk_hw_omap *clk, void __iomem *reg); +void omap2_clk_writel(u32 val, struct clk_hw_omap *clk, void __iomem *reg); + extern u16 cpu_mask; extern const struct clkops clkops_omap2_dflt_wait;