From patchwork Thu Feb 7 18:17:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongjin Kim X-Patchwork-Id: 2112551 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id F08FBDFB7B for ; Thu, 7 Feb 2013 18:18:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758817Ab3BGSSO (ORCPT ); Thu, 7 Feb 2013 13:18:14 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:48452 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758789Ab3BGSSO (ORCPT ); Thu, 7 Feb 2013 13:18:14 -0500 Received: by mail-pa0-f43.google.com with SMTP id bh2so1575157pad.16 for ; Thu, 07 Feb 2013 10:18:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=OORvacD4FadOFKqhKnwzb4JdZz4gmI+GNFXKWogitAc=; b=ueHZA5yOhOTzFpsr2LgGcuycdAQiJsanc6bhAaWLKFwcrgOE6hZoE5etAJv5BLSQR6 CybJG61qtKx0/vki/ravV7T7w1iLqxse8A6Cv3j/WwjJfaLkNvO1z+w8oOm3m0KlP+Dp SmQxwNzp8OxgR669Ifv+9eNDFpyWn8H7dCaUpqUQlnYasEd/Qe/l9onuCMod1nIJx4fF csFVLBxqSoASPb2VT82TyI5LWBymHiyAf2MSwg67qbLTXM1nkE/BJRnYCG8HL5KYVgd5 nd7dYLVNks/9aCiI2//lG8itfUDfhqHpV6Cx+sSiV4QqCBUvCD3XlACxzozoFxB6YSh2 a9Og== X-Received: by 10.66.88.37 with SMTP id bd5mr7995261pab.75.1360261093364; Thu, 07 Feb 2013 10:18:13 -0800 (PST) Received: from localhost.localdomain ([222.120.78.75]) by mx.google.com with ESMTPS id bi8sm47750600pab.15.2013.02.07.10.18.09 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Feb 2013 10:18:11 -0800 (PST) From: Dongjin Kim Cc: Dongjin Kim , Thomas Abraham , Linus Walleij , Seungwon Jeon , Jaehoon Chung , Chris Ball , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mmc: dw_mmc: No bus setup if default pinctrl is used Date: Fri, 8 Feb 2013 03:17:58 +0900 Message-Id: <1360261079-24361-1-git-send-email-tobetter@gmail.com> X-Mailer: git-send-email 1.7.10.4 To: unlisted-recipients:; (no To-header on input) Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Legacy gpio based bus setup is failed when the bus pins are listed with the property 'pinctrl-0' and 'pinctrl-names', instead of 'gpios'. The default pinctrls are handled by device core before probe, no need to configure the pins again in a device driver. [ 1.190000] Synopsys Designware Multimedia Card Interface Driver [ 1.195000] dwmmc_exynos 12550000.mshc: Using PIO mode. [ 1.200000] dwmmc_exynos 12550000.mshc: DW MMC controller at irq 109, 32 bit host data width, 128 deep fifo [ 1.210000] dwmmc_exynos 12550000.mshc: invalid gpio: -2 [ 1.215000] dwmmc_exynos: probe of 12550000.mshc failed with error -22 Cc: Thomas Abraham Cc: Linus Walleij Signed-off-by: Dongjin Kim --- drivers/mmc/host/dw_mmc-exynos.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c index aafd485..f568c32 100644 --- a/drivers/mmc/host/dw_mmc-exynos.c +++ b/drivers/mmc/host/dw_mmc-exynos.c @@ -156,12 +156,19 @@ static int dw_mci_exynos_setup_bus(struct dw_mci *host, struct device_node *slot_np, u8 bus_width) { int idx, gpio, ret; + int nr_pins = NUM_PINS(bus_width); if (!slot_np) return -EINVAL; +#if defined(CONFIG_PINCTRL) + /* Default pinctrl is used */ + if (!IS_ERR(host->dev->pins->default_state)) + nr_pins = 0; +#endif + /* cmd + clock + bus-width pins */ - for (idx = 0; idx < NUM_PINS(bus_width); idx++) { + for (idx = 0; idx < nr_pins; idx++) { gpio = of_get_gpio(slot_np, idx); if (!gpio_is_valid(gpio)) { dev_err(host->dev, "invalid gpio: %d\n", gpio);