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: 2313651 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 05841400E6 for ; Thu, 21 Mar 2013 13:59:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755870Ab3CUN7a (ORCPT ); Thu, 21 Mar 2013 09:59:30 -0400 Received: from mail-ve0-f176.google.com ([209.85.128.176]:62603 "EHLO mail-ve0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755858Ab3CUN73 convert rfc822-to-8bit (ORCPT ); Thu, 21 Mar 2013 09:59:29 -0400 Received: by mail-ve0-f176.google.com with SMTP id cz10so2401695veb.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 Cc: Jason Cooper , Andrew Lunn , Gregory Clement , linux-arm-kernel@lists.infradead.org, Maen Suleiman , Lior Amsalem , Ezequiel Garcia , Thomas Petazzoni 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) Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.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;