From patchwork Thu Mar 21 13:59:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralph Droms X-Patchwork-Id: 2313671 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 98E0FDF264 for ; Thu, 21 Mar 2013 14:03:09 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UIg1n-0004sC-1w; Thu, 21 Mar 2013 13:59:35 +0000 Received: from mail-vc0-f176.google.com ([209.85.220.176]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UIg1i-0004qv-RQ for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2013 13:59:31 +0000 Received: by mail-vc0-f176.google.com with SMTP id ib11so2271707vcb.21 for ; Thu, 21 Mar 2013 06:59:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:content-type:mime-version:subject:from:in-reply-to:date :cc:content-transfer-encoding:message-id:references:to:x-mailer; bh=jxr8TjxE7oGsjsg6HS6yGyVd/subT0HRkZGzM2r/2X8=; b=EguF9oSLQ8fFgq+28k8dlxUWdY5APEmcJji+lVOnFVJZIj1awISyEQ0EYwDZL5IVx+ 7a6tHsnjLn13SoKAq+xUo0P7J0rEBUno3pLOEApfPbZvLJeLVTAZmDmGOzWAdMStV0IU YBuM/giT5fBzTzcfDlgczUOCm8YPFTp3wK1UvuPQStzRNDSeuM4NvHHeFsjG6ASH2NH6 3Hobko6zdve1/lpQGa7nVI14WGHrtP4gCksOGXk6FjJUhYJZAmPf+jnziYBbs51ZTjU0 D1ieCppNAz8cX1bcpTpuzq/+HNqLEy9UKRMzGth6bd1Z3JN/ROZSnigQD4if2gf/7HXD ae/w== X-Received: by 10.52.37.81 with SMTP id w17mr11287345vdj.70.1363874368761; Thu, 21 Mar 2013 06:59:28 -0700 (PDT) Received: from ?IPv6:2001:420:2481:20:a84a:c13:127d:6761? ([2001:420:2481:20:a84a:c13:127d:6761]) by mx.google.com with ESMTPS id tp10sm40983015vec.1.2013.03.21.06.59.25 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Mar 2013 06:59:27 -0700 (PDT) Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Subject: Re: [PATCH v2] mmc: mvsdio: fix non-DT probing of GPIOs From: Ralph Droms In-Reply-To: <1363792148-26405-1-git-send-email-thomas.petazzoni@free-electrons.com> Date: Thu, 21 Mar 2013 09:59:22 -0400 Message-Id: References: <1363792148-26405-1-git-send-email-thomas.petazzoni@free-electrons.com> To: Chris Ball , linux-mmc@vger.kernel.org X-Mailer: Apple Mail (2.1499) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130321_095930_934989_F5DEABE1 X-CRM114-Status: GOOD ( 19.36 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (rdroms[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.176 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Lior Amsalem , Andrew Lunn , Jason Cooper , Maen Suleiman , Ezequiel Garcia , Gregory Clement , Thomas Petazzoni , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org I've tested the patch and it's OK. - Ralph Droms On Mar 20, 2013, at 11:09 AM 3/20/13, Thomas Petazzoni wrote: Ralph Droms reported that 3.9-rc was breaking the SDIO interface on his Sheevaplug platform, and that the recent changes to the mvsdio driver are responsible for this breakage. After investigation, is turns out that the Sheevaplug does not have any "card detect" GPIO, and the Sheevaplug has not been converted to the Device Tree. Therefore, the Sheevaplug board code does not define a value for the .gpio_card_detect field of the mvsdio_platform_data structure, which means that its value is 0. Unfortunately, gpio_is_valid() considers 0 as a valid GPIO, and therefore calls mmc_gpio_request_cd(), which fails and makes the entire probing of the driver fail. In fact, in the previous mvsdio code, before the Device Tree binding was introduced, 0 was not considered as a valid GPIO. Therefore, this fix revert back to this behavior in the non-DT case, by setting the gpio_card_detect and gpio_write_protect local variables to -EINVAL when the corresponding fields of the mvsdio_platform_data structure are set to zero (i.e, left undefined). Of course, it prevents to use GPIO 0 as a card detect or write protect GPIO, but it was a defiency of the previous non-DT code, and the fix moving forward is to convert platforms to the Device Tree. The problem has been reproduced successfully on the Kirkwood-based Marvell DB-88F6281-BP Development Board (that doesn't use the Device Tree) and the fix has proven to work properly, after of course removing the gpio_card_detect field of the mvsdio_platform_data instance for this board. Reported-by: Ralph Droms Signed-off-by: Thomas Petazzoni Tested-by: Ralph Droms --- This patch should be applied on 3.9-rcX. Changes between v1 and v2: * Send the patch to the MMC maintainer instead of the Marvell maintainers. --- drivers/mmc/host/mvsdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c index 145cdaf..1e4d567 100644 --- a/drivers/mmc/host/mvsdio.c +++ b/drivers/mmc/host/mvsdio.c @@ -741,8 +741,8 @@ static int __init mvsd_probe(struct platform_device *pdev) goto out; } host->base_clock = mvsd_data->clock / 2; - gpio_card_detect = mvsd_data->gpio_card_detect; - gpio_write_protect = mvsd_data->gpio_write_protect; + gpio_card_detect = mvsd_data->gpio_card_detect ? : -EINVAL; + gpio_write_protect = mvsd_data->gpio_write_protect ? : -EINVAL; } mmc->ops = &mvsd_ops;