From patchwork Fri Sep 22 11:22:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 9965823 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 ADA6F600C5 for ; Fri, 22 Sep 2017 11:22:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E0BB28B38 for ; Fri, 22 Sep 2017 11:22:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92F1129093; Fri, 22 Sep 2017 11:22:39 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham 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 832B128B38 for ; Fri, 22 Sep 2017 11:22:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752104AbdIVLWg (ORCPT ); Fri, 22 Sep 2017 07:22:36 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:60071 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752086AbdIVLWf (ORCPT ); Fri, 22 Sep 2017 07:22:35 -0400 Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie3.idc.renesas.com with ESMTP; 22 Sep 2017 20:22:34 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 498C16DE19; Fri, 22 Sep 2017 20:22:34 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.42,427,1500908400"; d="scan'208";a="257462886" Received: from unknown (HELO fabrizio-dev.ree.adwin.renesas.com) ([10.226.37.27]) by relmlii1.idc.renesas.com with ESMTP; 22 Sep 2017 20:22:31 +0900 From: Fabrizio Castro To: Ulf Hansson , Simon Horman Cc: Wolfram Sang , kuninori.morimoto.gx@renesas.com, Chris Paterson , Biju Das , Fabrizio Castro , linux-mmc@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: [RFC PATCH] mmc: tmio: check mmc_regulator_get_supply return value Date: Fri, 22 Sep 2017 12:22:17 +0100 Message-Id: <1506079337-12882-1-git-send-email-fabrizio.castro@bp.renesas.com> X-Mailer: git-send-email 2.7.4 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 mmc_regulator_get_supply returns -EPROBE_DEFER if either vmmc or vqmmc regulators had their probing deferred. vqmmc regulator is needed by UHS to work properly, therefore this patch checks the value returned by mmc_regulator_get_supply to make sure we have a reference to both vmmc and vqmmc (if found in the DT). Signed-off-by: Fabrizio Castro Reviewed-by: Wolfram Sang Tested-by: Wolfram Sang --- I believe this patch is in order for UHS to work properly on the RZ/G1 platforms as the signal voltage needs to be switched from 3.3V to 1.8V, and therefore we need to make sure we hold a reference to vqmmc. Without this patch there is a chance that the regulator driver gets probed later on and therefore we end up without control over the power regulator. I have seen an RZ/G1E based platform failing the transition to UHS because of this. However, there are side effects to it as the mmc devices will be enumerated in a different order (due to -EPROBE_DEFER), this means this patch would likely break existing platforms. Please, let me know your comments. drivers/mmc/host/tmio_mmc_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 88a9435..3df0413 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1153,8 +1153,11 @@ static int tmio_mmc_init_ocr(struct tmio_mmc_host *host) { struct tmio_mmc_data *pdata = host->pdata; struct mmc_host *mmc = host->mmc; + int err; - mmc_regulator_get_supply(mmc); + err = mmc_regulator_get_supply(mmc); + if (err) + return err; /* use ocr_mask if no regulator */ if (!mmc->ocr_avail)