From patchwork Wed Nov 20 08:30:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 3212111 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 E1D6C9F499 for ; Wed, 20 Nov 2013 08:30:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BB2A8206EC for ; Wed, 20 Nov 2013 08:30:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9BB16206DC for ; Wed, 20 Nov 2013 08:30:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752235Ab3KTIal (ORCPT ); Wed, 20 Nov 2013 03:30:41 -0500 Received: from mail-pb0-f45.google.com ([209.85.160.45]:35577 "EHLO mail-pb0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752075Ab3KTIak (ORCPT ); Wed, 20 Nov 2013 03:30:40 -0500 Received: by mail-pb0-f45.google.com with SMTP id rp16so3177113pbb.18 for ; Wed, 20 Nov 2013 00:30:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:sender:message-id:to:cc:in-reply-to:references:from:subject :mime-version:content-type; bh=MXbknXOwW98ZoCESpwR6seZKnzGigkKask21nGPbCrE=; b=E+G8HAOToW+nMIhpI2/TL8IVypge1a5VoL/7Uf5t/GZYyU+Si8O2dL6HS9OPIG77pG 1fBCXCuSu4m9FjNwFIugxdTwDVa7MhKP59WR6e6VgUyWAx4eCAXfjLsayni3WqOzoV2p Pc6Tb9PbFPbFZY2vG7s3cZSzXkZcCwslaGESvbAjx/zFv7b1SVsR5CstvbVm8VKwO4Ms +Gm6FjdvwH7rmeL3g7aYMH4rKdB3TGNIlvd7HNj3/9x7uJX6YppXPQ50XAP7vdNx+RdA sT1BNefxGzq+F7HGL+jO++7ssKIS2z5vfoAm8PlBsFL6ipwK/AI0Qm2rrdGYgTFA6wa6 0gDQ== X-Received: by 10.68.175.66 with SMTP id by2mr314424pbc.172.1384936239775; Wed, 20 Nov 2013 00:30:39 -0800 (PST) Received: from morimoto-Dell-XPS420.gmail.com (49.14.32.202.bf.2iij.net. [202.32.14.49]) by mx.google.com with ESMTPSA id oj6sm40857470pab.9.2013.11.20.00.30.38 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 20 Nov 2013 00:30:39 -0800 (PST) Date: Wed, 20 Nov 2013 00:30:39 -0800 (PST) Message-ID: <87hab78ogj.wl%kuninori.morimoto.gx@renesas.com> To: Simon , Chris Ball Cc: Magnus , Linux-SH , Kuninori Morimoto , linux-mmc@vger.kernel.org In-Reply-To: <87iovn8ohs.wl%kuninori.morimoto.gx@renesas.com> References: <87iovn8ohs.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 1/4] mmc: tmio: use -EPROBE_DEFER if driver can't find regulator MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, 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 Current tmio driver tries to use default ocr_avail if 1) it couldn't find regulator and 2) if platform data doesn't have ocr_mask. But, there is no guarantee that regulator driver probe is faster than TMIO driver probe. TMIO driver will not use regulator in such case. By this patch, TMIO driver returns -EPROBE_DEFER if it couldn't find regulator and if platform doesn't have ocr_mask. Because, there is possibility that regulator has not been probed, but the user is expecting it. This patch changes tmio_mmc_host_probe() behavior, but there is no user who has conflict. Signed-off-by: Kuninori Morimoto --- drivers/mmc/host/tmio_mmc_pio.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c index b380225..7b25d0e 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c @@ -944,17 +944,25 @@ static const struct mmc_host_ops tmio_mmc_ops = { .enable_sdio_irq = tmio_mmc_enable_sdio_irq, }; -static void tmio_mmc_init_ocr(struct tmio_mmc_host *host) +static int tmio_mmc_init_ocr(struct tmio_mmc_host *host) { struct tmio_mmc_data *pdata = host->pdata; struct mmc_host *mmc = host->mmc; mmc_regulator_get_supply(mmc); + /* use ocr_mask if no regulator */ if (!mmc->ocr_avail) - mmc->ocr_avail = pdata->ocr_mask ? : MMC_VDD_32_33 | MMC_VDD_33_34; - else if (pdata->ocr_mask) - dev_warn(mmc_dev(mmc), "Platform OCR mask is ignored\n"); + mmc->ocr_avail = pdata->ocr_mask; + + /* + * try again. + * There is possibility that regulator has not been probed + */ + if (!mmc->ocr_avail) + return -EPROBE_DEFER; + + return 0; } static void tmio_mmc_of_parse(struct platform_device *pdev, @@ -1008,6 +1016,10 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host, /* SD control register space size is 0x200, 0x400 for bus_shift=1 */ _host->bus_shift = resource_size(res_ctl) >> 10; + ret = tmio_mmc_init_ocr(_host); + if (ret < 0) + goto host_free; + _host->ctl = ioremap(res_ctl->start, resource_size(res_ctl)); if (!_host->ctl) { ret = -ENOMEM; @@ -1023,7 +1035,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host, mmc->max_segs; mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; mmc->max_seg_size = mmc->max_req_size; - tmio_mmc_init_ocr(_host); _host->native_hotplug = !(pdata->flags & TMIO_MMC_USE_GPIO_CD || mmc->caps & MMC_CAP_NEEDS_POLL ||