From patchwork Wed Jun 7 08:36:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 9770897 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6DE0460364 for ; Wed, 7 Jun 2017 08:37:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 555EB1FFB7 for ; Wed, 7 Jun 2017 08:37:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A2DE28512; Wed, 7 Jun 2017 08:37:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 005071FFB7 for ; Wed, 7 Jun 2017 08:37:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751538AbdFGIhP (ORCPT ); Wed, 7 Jun 2017 04:37:15 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:35134 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751444AbdFGIhI (ORCPT ); Wed, 7 Jun 2017 04:37:08 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v578af5I026436; Wed, 7 Jun 2017 03:36:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1496824601; bh=0n6nvXgEs7OTE1ybkb+kOt+nOY8EUYfVJIwLmf43pI4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=mgq5y77lZWA/vBp4cw1UaW0YHyzo0fo6c7adPNbUyIUFlIqqVvcVWzF2Z938vKFul sZWwfJi2BZ3REHVa7BJoKBxa/Ro2/sLY7YhgFrKPiheY7Y6D+v1iXxmE0TKyG1EtGd rk+5hgfZCdSToRFljlYMj35vSLP5h1vR4Zl0xqyw= Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v578afdT000608; Wed, 7 Jun 2017 03:36:41 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.294.0; Wed, 7 Jun 2017 03:36:40 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v578aOQA023424; Wed, 7 Jun 2017 03:36:36 -0500 From: Kishon Vijay Abraham I To: Ulf Hansson , Tony Lindgren , Rob Herring , CC: , , , , , Subject: [PATCH 2/3] mmc: host: omap_hsmmc: use mmc_regulator_get_supply() to get regulators Date: Wed, 7 Jun 2017 14:06:11 +0530 Message-ID: <20170607083612.14224-3-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170607083612.14224-1-kishon@ti.com> References: <20170607083612.14224-1-kishon@ti.com> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In preparation for using the generic mmc binding for io regulator ("vqmmc"), use mmc_regulator_get_supply() to get vmmc and vqmmc regulators. Only if "vqmmc" regulator isn't found, fallback to use "vmmc_aux" regulator. Signed-off-by: Kishon Vijay Abraham I --- drivers/mmc/host/omap_hsmmc.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index de82ac0a87e2..f6da8bc0d64f 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -466,34 +466,27 @@ static int omap_hsmmc_disable_boot_regulators(struct omap_hsmmc_host *host) static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) { - int ocr_value = 0; int ret; struct mmc_host *mmc = host->mmc; if (mmc_pdata(host)->set_power) return 0; - mmc->supply.vmmc = devm_regulator_get_optional(host->dev, "vmmc"); - if (IS_ERR(mmc->supply.vmmc)) { - ret = PTR_ERR(mmc->supply.vmmc); - if ((ret != -ENODEV) && host->dev->of_node) - return ret; - dev_dbg(host->dev, "unable to get vmmc regulator %ld\n", - PTR_ERR(mmc->supply.vmmc)); - } else { - ocr_value = mmc_regulator_get_ocrmask(mmc->supply.vmmc); - if (ocr_value > 0) - mmc_pdata(host)->ocr_mask = ocr_value; - } + ret = mmc_regulator_get_supply(mmc); + if (ret == -EPROBE_DEFER) + return ret; /* Allow an aux regulator */ - mmc->supply.vqmmc = devm_regulator_get_optional(host->dev, "vmmc_aux"); if (IS_ERR(mmc->supply.vqmmc)) { - ret = PTR_ERR(mmc->supply.vqmmc); - if ((ret != -ENODEV) && host->dev->of_node) - return ret; - dev_dbg(host->dev, "unable to get vmmc_aux regulator %ld\n", - PTR_ERR(mmc->supply.vqmmc)); + mmc->supply.vqmmc = devm_regulator_get_optional(host->dev, + "vmmc_aux"); + if (IS_ERR(mmc->supply.vqmmc)) { + ret = PTR_ERR(mmc->supply.vqmmc); + if ((ret != -ENODEV) && host->dev->of_node) + return ret; + dev_dbg(host->dev, "unable to get vmmc_aux regulator %ld\n", + PTR_ERR(mmc->supply.vqmmc)); + } } host->pbias = devm_regulator_get_optional(host->dev, "pbias"); @@ -2143,7 +2136,8 @@ static int omap_hsmmc_probe(struct platform_device *pdev) if (ret) goto err_irq; - mmc->ocr_avail = mmc_pdata(host)->ocr_mask; + if (mmc_pdata(host)->ocr_mask) + mmc->ocr_avail = mmc_pdata(host)->ocr_mask; omap_hsmmc_disable_irq(host);