From patchwork Fri Aug 30 09:47:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuvaraj CD X-Patchwork-Id: 2851846 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B61169F2F4 for ; Fri, 30 Aug 2013 09:48:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8F7A8202E6 for ; Fri, 30 Aug 2013 09:48:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 66BFE2024A for ; Fri, 30 Aug 2013 09:48:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754755Ab3H3JsH (ORCPT ); Fri, 30 Aug 2013 05:48:07 -0400 Received: from mail-pb0-f50.google.com ([209.85.160.50]:59053 "EHLO mail-pb0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754717Ab3H3JsG (ORCPT ); Fri, 30 Aug 2013 05:48:06 -0400 Received: by mail-pb0-f50.google.com with SMTP id uo5so1674453pbc.9 for ; Fri, 30 Aug 2013 02:48:06 -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=9WtKo3HgIV/vCAkrTi5vq1GmYfChTWjaDj9Wpb960SA=; b=rA/e5uV1yyXFyoGLBhJDsvoX5XTSQ5E4V1kW5eO5kjw4hvM2+x6YdxGen03SLaZIfF GYDCD8U0WTVGYaJookLzSjg/RvLQe2+iKxZxDy7XCFINtCy1Z92654zt2sYOu1cuscKO JNttkeKHJbzUr+TRkPswr0nzE78JFmTu7b9AIm6m03bZ9+t+4wuWTUddy6Kgll0uI8z2 02Ple3NjUcsxPyGKcOJhyNPHvPcLIVhu0+t/UUGg7LHgrNRUqH9HlRacn/kBD/roUfZi MeiveGwoHeY/01ewdDbPRCZAzPuj7sXYzPOC2AMxjjEdVeewlGn5KpU8TO1vToYz5aMM 8XLg== X-Received: by 10.68.90.1 with SMTP id bs1mr8820142pbb.169.1377856085995; Fri, 30 Aug 2013 02:48:05 -0700 (PDT) Received: from yuvaraj-ubuntu.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id lm2sm46712834pab.2.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 30 Aug 2013 02:48:05 -0700 (PDT) From: Yuvaraj Kumar C D To: linux-mmc@vger.kernel.org, linux-samsung-soc@vger.kernel.org, cjb@laptop.org, jh80.chung@samsung.com, tgih.jun@samsung.com Cc: ks.giri@samsung.com, t.figa@samsung.com, alim.akhtar@samsung.com, dianders@chromium.org, Yuvaraj Kumar C D Subject: [RFC V4 2/4] mmc: dw_mmc: socfpga: move socfpga private init Date: Fri, 30 Aug 2013 15:17:41 +0530 Message-Id: <1377856063-3391-3-git-send-email-yuvaraj.cd@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1377856063-3391-1-git-send-email-yuvaraj.cd@samsung.com> References: <1377856063-3391-1-git-send-email-yuvaraj.cd@samsung.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 Currently platform specific private data initialisation is done by dw_mci_socfpga_priv_init and dw_mci_socfpga_parse_dt.As we already have separate platform specific device tree parser dw_mci_socfpga_parse_dt, move the dw_mci_socfpga_priv_init code to dw_mci_socfpga_parse_dt. We can use the dw_mci_socfpga_priv_init to do some actual platform specific initialisation. This patch is compile tested only. changes since V3: none changes since V2: none Signed-off-by: Yuvaraj Kumar C D --- drivers/mmc/host/dw_mmc-socfpga.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/mmc/host/dw_mmc-socfpga.c b/drivers/mmc/host/dw_mmc-socfpga.c index 14b5961..953f260 100644 --- a/drivers/mmc/host/dw_mmc-socfpga.c +++ b/drivers/mmc/host/dw_mmc-socfpga.c @@ -38,20 +38,6 @@ struct dw_mci_socfpga_priv_data { static int dw_mci_socfpga_priv_init(struct dw_mci *host) { - struct dw_mci_socfpga_priv_data *priv; - - priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL); - if (!priv) { - dev_err(host->dev, "mem alloc failed for private data\n"); - return -ENOMEM; - } - - priv->sysreg = syscon_regmap_lookup_by_compatible("altr,sys-mgr"); - if (IS_ERR(priv->sysreg)) { - dev_err(host->dev, "regmap for altr,sys-mgr lookup failed.\n"); - return PTR_ERR(priv->sysreg); - } - host->priv = priv; return 0; } @@ -79,12 +65,24 @@ static void dw_mci_socfpga_prepare_command(struct dw_mci *host, u32 *cmdr) static int dw_mci_socfpga_parse_dt(struct dw_mci *host) { - struct dw_mci_socfpga_priv_data *priv = host->priv; + struct dw_mci_socfpga_priv_data *priv; struct device_node *np = host->dev->of_node; u32 timing[2]; u32 div = 0; int ret; + priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) { + dev_err(host->dev, "mem alloc failed for private data\n"); + return -ENOMEM; + } + + priv->sysreg = syscon_regmap_lookup_by_compatible("altr,sys-mgr"); + if (IS_ERR(priv->sysreg)) { + dev_err(host->dev, "regmap for altr,sys-mgr lookup failed.\n"); + return PTR_ERR(priv->sysreg); + } + ret = of_property_read_u32(np, "altr,dw-mshc-ciu-div", &div); if (ret) dev_info(host->dev, "No dw-mshc-ciu-div specified, assuming 1"); @@ -96,6 +94,7 @@ static int dw_mci_socfpga_parse_dt(struct dw_mci *host) return ret; priv->hs_timing = SYSMGR_SDMMC_CTRL_SET(timing[0], timing[1]); + host->priv = priv; return 0; }