From patchwork Fri May 9 15:37:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balaji T K X-Patchwork-Id: 4144211 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6F8FDBFF02 for ; Fri, 9 May 2014 15:37:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 966712017D for ; Fri, 9 May 2014 15:37:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DF1E620179 for ; Fri, 9 May 2014 15:37:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752029AbaEIPhZ (ORCPT ); Fri, 9 May 2014 11:37:25 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:34497 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750987AbaEIPhY (ORCPT ); Fri, 9 May 2014 11:37:24 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s49FbFOZ012508; Fri, 9 May 2014 10:37:15 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s49FbEbV011297; Fri, 9 May 2014 10:37:15 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Fri, 9 May 2014 10:37:14 -0500 Received: from ulaa0393241.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s49FbCSD026781; Fri, 9 May 2014 10:37:12 -0500 From: Balaji T K To: , , , , CC: Balaji T K Subject: [PATCH] mmc: core: Add DT bindings for card detect debounce time Date: Fri, 9 May 2014 21:07:17 +0530 Message-ID: <1399649837-27286-1-git-send-email-balajitk@ti.com> X-Mailer: git-send-email 1.7.5.4 MIME-Version: 1.0 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.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 Provide an option to get CD debounce time from DT Signed-off-by: Balaji T K --- Documentation/devicetree/bindings/mmc/mmc.txt | 1 + drivers/mmc/core/host.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/Documentation/devicetree/bindings/mmc/mmc.txt b/Documentation/devicetree/bindings/mmc/mmc.txt index 9dce540..fae590b 100644 --- a/Documentation/devicetree/bindings/mmc/mmc.txt +++ b/Documentation/devicetree/bindings/mmc/mmc.txt @@ -17,6 +17,7 @@ Optional properties: - bus-width: Number of data lines, can be <1>, <4>, or <8>. The default will be <1> if the property is absent. - wp-gpios: Specify GPIOs for write protection, see gpio binding +- cd-debounce-us: debounce time in microseconds for card detect gpio. - cd-inverted: when present, polarity on the CD line is inverted. See the note below for the case, when a GPIO is used for the CD line - wp-inverted: when present, polarity on the WP line is inverted. See the note diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index fdea825..59cd3a0 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -313,6 +313,7 @@ int mmc_of_parse(struct mmc_host *host) bool explicit_inv_wp, gpio_inv_wp = false; enum of_gpio_flags flags; int len, ret, gpio; + unsigned int debounce; if (!host->parent || !host->parent->of_node) return 0; @@ -367,6 +368,9 @@ int mmc_of_parse(struct mmc_host *host) if (of_find_property(np, "broken-cd", &len)) host->caps |= MMC_CAP_NEEDS_POLL; + if (of_property_read_u32(np, "cd-debounce-us", &debounce) < 0) + debounce = 0; + gpio = of_get_named_gpio_flags(np, "cd-gpios", 0, &flags); if (gpio == -EPROBE_DEFER) return gpio; @@ -374,7 +378,7 @@ int mmc_of_parse(struct mmc_host *host) if (!(flags & OF_GPIO_ACTIVE_LOW)) gpio_inv_cd = true; - ret = mmc_gpio_request_cd(host, gpio, 0); + ret = mmc_gpio_request_cd(host, gpio, debounce); if (ret < 0) { dev_err(host->parent, "Failed to request CD GPIO #%d: %d!\n",