From patchwork Thu Oct 15 13:46:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 55025 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id B0DB122FFA for ; Thu, 15 Oct 2015 13:49:54 +0000 (UTC) Received: by wicid10 with SMTP id id10sf10102181wic.2 for ; Thu, 15 Oct 2015 06:49:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:cc:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=5m9naO/i6c5vKDj5uotcK2FxkzJgY7IyOnOAHNtYZgY=; b=fAmOY5uQAu5CU2CJ40ELkrVQOZwMiLvFnMJm6jYFEtTRQ7IenIM7RFJVl9EhjGHv/f I4KjPWDIsCu5c5w1mw5GjwW5oFOHLl6x/pRK915HGwQ0PVYdyugfsp3bz/i7Fr9i5ln2 6Z250mAGsREAaO+xS7zf9BQE4/u8ZxWg2dH+Qc9Jv4JZCWchTAvrJpYxnk8ie0n+gPQW C5+rgd/DxjHH8TuSWjSP5Fn20K4axqID70lsyzmgLdqev+HKkUIf00V+oLNA7FAEmVSl tK+ZJ9GfbKuq3eFmRtfQGCMI2uboLMuHo+DPPwOgLpUTeouV1N+H6JqMdT06tINFyb/b V4Mg== X-Gm-Message-State: ALoCoQnuguTC7CzIKIh34uCmDhmOQ5wZLu75IeRD4leSPnYLITbxMikH07tafTlUGpVqT5zafmzB X-Received: by 10.180.210.212 with SMTP id mw20mr6948738wic.3.1444916994041; Thu, 15 Oct 2015 06:49:54 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.43.133 with SMTP id r127ls151256lfr.74.gmail; Thu, 15 Oct 2015 06:49:53 -0700 (PDT) X-Received: by 10.25.29.20 with SMTP id d20mr2966744lfd.107.1444916993899; Thu, 15 Oct 2015 06:49:53 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id jd9si9191775lbc.140.2015.10.15.06.49.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2015 06:49:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by lbbwb3 with SMTP id wb3so7257388lbb.1 for ; Thu, 15 Oct 2015 06:49:53 -0700 (PDT) X-Received: by 10.112.139.201 with SMTP id ra9mr4571789lbb.29.1444916993749; Thu, 15 Oct 2015 06:49:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp646027lbq; Thu, 15 Oct 2015 06:49:52 -0700 (PDT) X-Received: by 10.50.50.40 with SMTP id z8mr32909234ign.85.1444916992706; Thu, 15 Oct 2015 06:49:52 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id b18si11023771ioe.127.2015.10.15.06.49.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2015 06:49:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; 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 1Zmite-0002gS-8A; Thu, 15 Oct 2015 13:48:42 +0000 Received: from mail-lb0-f172.google.com ([209.85.217.172]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zmiss-0001r0-2W for linux-arm-kernel@lists.infradead.org; Thu, 15 Oct 2015 13:47:55 +0000 Received: by lbbpp2 with SMTP id pp2so40194533lbb.0 for ; Thu, 15 Oct 2015 06:47:32 -0700 (PDT) X-Received: by 10.112.167.8 with SMTP id zk8mr4605392lbb.15.1444916852082; Thu, 15 Oct 2015 06:47:32 -0700 (PDT) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id ug9sm2056977lbb.22.2015.10.15.06.47.29 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2015 06:47:31 -0700 (PDT) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Russell King Subject: [PATCH 07/13] clk: versatile-icst: refactor to allocate regmap separately Date: Thu, 15 Oct 2015 15:46:47 +0200 Message-Id: <1444916813-31024-8-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1444916813-31024-1-git-send-email-linus.walleij@linaro.org> References: <1444916813-31024-1-git-send-email-linus.walleij@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151015_064754_396368_8F55EB0D X-CRM114-Status: GOOD ( 18.58 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.217.172 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.217.172 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Cc: Mark Rutland , Pawel Moll , Marc Zyngier , Stephen Boyd , Linus Walleij , Will Deacon , linux-clk@vger.kernel.org, Michael Turquette MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Break out the registration function so it creates a regmap and pass to the setup function, so the latter can be shared with a device tree probe function that already has a regmap. Cc: Michael Turquette Cc: Stephen Boyd Cc: linux-clk@vger.kernel.org Signed-off-by: Linus Walleij --- I'm looking for an ACK from the CLK maintainers to take this through the ARM SoC tree once the series stabilize. --- drivers/clk/versatile/clk-icst.c | 44 +++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c index da5a3ccbbb96..ab5d5f73818b 100644 --- a/drivers/clk/versatile/clk-icst.c +++ b/drivers/clk/versatile/clk-icst.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "clk-icst.h" @@ -140,21 +141,16 @@ static const struct clk_ops icst_ops = { .set_rate = icst_set_rate, }; -struct clk *icst_clk_register(struct device *dev, +struct clk *icst_clk_setup(struct device *dev, const struct clk_icst_desc *desc, const char *name, const char *parent_name, - void __iomem *base) + struct regmap *map) { struct clk *clk; struct clk_icst *icst; struct clk_init_data init; struct icst_params *pclone; - struct regmap_config icst_regmap_conf = { - .reg_bits = 32, - .val_bits = 32, - .reg_stride = 4, - }; icst = kzalloc(sizeof(struct clk_icst), GFP_KERNEL); if (!icst) { @@ -174,15 +170,7 @@ struct clk *icst_clk_register(struct device *dev, init.flags = CLK_IS_ROOT; init.parent_names = (parent_name ? &parent_name : NULL); init.num_parents = (parent_name ? 1 : 0); - icst->map = regmap_init_mmio(NULL, base, &icst_regmap_conf); - if (IS_ERR(icst->map)) { - int ret; - - pr_err("could not initialize ICST regmap\n"); - kfree(icst); - ret = PTR_ERR(icst->map); - return ERR_PTR(ret); - } + icst->map = map; icst->hw.init = &init; icst->params = pclone; icst->vcoreg_off = desc->vco_offset; @@ -194,4 +182,28 @@ struct clk *icst_clk_register(struct device *dev, return clk; } + +struct clk *icst_clk_register(struct device *dev, + const struct clk_icst_desc *desc, + const char *name, + const char *parent_name, + void __iomem *base) +{ + struct regmap_config icst_regmap_conf = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, + }; + struct regmap *map; + + map = regmap_init_mmio(NULL, base, &icst_regmap_conf); + if (IS_ERR(map)) { + int ret; + + pr_err("could not initialize ICST regmap\n"); + ret = PTR_ERR(map); + return ERR_PTR(ret); + } + return icst_clk_setup(dev, desc, name, parent_name, map); +} EXPORT_SYMBOL_GPL(icst_clk_register);