From patchwork Thu Dec 26 10:18:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tushar Behera X-Patchwork-Id: 22748 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f72.google.com (mail-vb0-f72.google.com [209.85.212.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9731B218F0 for ; Thu, 26 Dec 2013 10:22:37 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id x8sf9195785vbf.3 for ; Thu, 26 Dec 2013 02:22:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=nASXfgPNpMZU+3buXaBfi7zgDcO1tM11jhQqgz/g+dM=; b=NjV24LDtwBO8A6ahVtDQs0kvkRLDWpRqBRmI7NVsHaNJx1ytHOIPYocTirOEpZIK1i YC52Eddvc0LU6Vidumdr9GamBWEDD2IdYFen/KwBe8e8q1Eam0eP/3w1izoNqCAjdX7P 01DoXRfpYT6fAew0Sps74qvCn2mhcamCW0UxolNu6igwJuzMHqqJxOYnk4qu/EosEpwN ZUNNyF2g4KDdx7lLrisejG61+5UCoBs2d+niUmDbl5O2aBHNL1GhtdGFgn67ILWF2s3M vKYFasOnYZYzEzxJ5W90tjgTXpFwiXgijXEBqHO2/HnX5e6szXQdEJKbfBMX6Jzpvsew tGIg== X-Gm-Message-State: ALoCoQnQpQm0QI638JjiycwbN7L6OgEvFjY63E9XG/+X1jQuB3h6drK5bigGONrcr8KpsHenhmiS X-Received: by 10.58.215.130 with SMTP id oi2mr15622560vec.27.1388053356581; Thu, 26 Dec 2013 02:22:36 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.40.194 with SMTP id z2ls2461014qek.23.gmail; Thu, 26 Dec 2013 02:22:36 -0800 (PST) X-Received: by 10.52.32.227 with SMTP id m3mr34836vdi.72.1388053356466; Thu, 26 Dec 2013 02:22:36 -0800 (PST) Received: from mail-vb0-f49.google.com (mail-vb0-f49.google.com [209.85.212.49]) by mx.google.com with ESMTPS id vo6si3802763vcb.125.2013.12.26.02.22.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Dec 2013 02:22:36 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.49 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.49; Received: by mail-vb0-f49.google.com with SMTP id x11so4053160vbb.22 for ; Thu, 26 Dec 2013 02:22:36 -0800 (PST) X-Received: by 10.58.172.130 with SMTP id bc2mr38379vec.71.1388053356381; Thu, 26 Dec 2013 02:22:36 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp388053ved; Thu, 26 Dec 2013 02:22:35 -0800 (PST) X-Received: by 10.66.154.75 with SMTP id vm11mr43712566pab.124.1388053355379; Thu, 26 Dec 2013 02:22:35 -0800 (PST) Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) by mx.google.com with ESMTPS id s7si15719825pae.11.2013.12.26.02.22.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Dec 2013 02:22:35 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.51 is neither permitted nor denied by best guess record for domain of tushar.behera@linaro.org) client-ip=209.85.220.51; Received: by mail-pa0-f51.google.com with SMTP id fa1so8160133pad.38 for ; Thu, 26 Dec 2013 02:22:34 -0800 (PST) X-Received: by 10.66.248.227 with SMTP id yp3mr42587074pac.116.1388053354918; Thu, 26 Dec 2013 02:22:34 -0800 (PST) Received: from linaro.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id ha10sm54123051pbd.17.2013.12.26.02.22.31 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Dec 2013 02:22:34 -0800 (PST) From: Tushar Behera To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Cc: mturquette@linaro.org, lee.jones@linaro.org, kgene.kim@samsung.com, patches@linaro.org Subject: [PATCH RESEND 1/4] clk: clk-s2mps11: Refactor for including support for other MFD clocks Date: Thu, 26 Dec 2013 15:48:58 +0530 Message-Id: <1388053141-30085-2-git-send-email-tushar.behera@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1388053141-30085-1-git-send-email-tushar.behera@linaro.org> References: <1383202124-1775-1-git-send-email-tushar.behera@linaro.org> <1388053141-30085-1-git-send-email-tushar.behera@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: tushar.behera@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.49 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The clocks in S2MPS11 and S5M8767 are managed in the same way, baring a difference in the register offset. It would be better to update existing S2MPS11 driver to support the clocks in S5M8767, rather than creating an almost duplicate driver altogether. Signed-off-by: Tushar Behera Reviewed-by: Tomasz Figa Reviewed-by: Yadwinder Singh Brar CC: Mike Turquette --- drivers/clk/clk-s2mps11.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c index 00a3abe..43e25bb 100644 --- a/drivers/clk/clk-s2mps11.c +++ b/drivers/clk/clk-s2mps11.c @@ -48,6 +48,7 @@ struct s2mps11_clk { struct clk_lookup *lookup; u32 mask; bool enabled; + unsigned int reg; }; static struct s2mps11_clk *to_s2mps11_clk(struct clk_hw *hw) @@ -61,7 +62,7 @@ static int s2mps11_clk_prepare(struct clk_hw *hw) int ret; ret = regmap_update_bits(s2mps11->iodev->regmap_pmic, - S2MPS11_REG_RTC_CTRL, + s2mps11->reg, s2mps11->mask, s2mps11->mask); if (!ret) s2mps11->enabled = true; @@ -74,7 +75,7 @@ static void s2mps11_clk_unprepare(struct clk_hw *hw) struct s2mps11_clk *s2mps11 = to_s2mps11_clk(hw); int ret; - ret = regmap_update_bits(s2mps11->iodev->regmap_pmic, S2MPS11_REG_RTC_CTRL, + ret = regmap_update_bits(s2mps11->iodev->regmap_pmic, s2mps11->reg, s2mps11->mask, ~s2mps11->mask); if (!ret) @@ -155,6 +156,7 @@ static int s2mps11_clk_probe(struct platform_device *pdev) struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); struct s2mps11_clk *s2mps11_clks, *s2mps11_clk; struct device_node *clk_np = NULL; + unsigned int s2mps11_reg; int i, ret = 0; u32 val; @@ -169,13 +171,23 @@ static int s2mps11_clk_probe(struct platform_device *pdev) if (IS_ERR(clk_np)) return PTR_ERR(clk_np); + switch(platform_get_device_id(pdev)->driver_data) { + case S2MPS11X: + s2mps11_reg = S2MPS11_REG_RTC_CTRL; + break; + default: + dev_err(&pdev->dev, "Invalid device type\n"); + return -EINVAL; + }; + for (i = 0; i < S2MPS11_CLKS_NUM; i++, s2mps11_clk++) { s2mps11_clk->iodev = iodev; s2mps11_clk->hw.init = &s2mps11_clks_init[i]; s2mps11_clk->mask = 1 << i; + s2mps11_clk->reg = s2mps11_reg; ret = regmap_read(s2mps11_clk->iodev->regmap_pmic, - S2MPS11_REG_RTC_CTRL, &val); + s2mps11_clk->reg, &val); if (ret < 0) goto err_reg; @@ -241,7 +253,7 @@ static int s2mps11_clk_remove(struct platform_device *pdev) } static const struct platform_device_id s2mps11_clk_id[] = { - { "s2mps11-clk", 0}, + { "s2mps11-clk", S2MPS11X}, { }, }; MODULE_DEVICE_TABLE(platform, s2mps11_clk_id);