From patchwork Mon Apr 22 19:54:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Baatz X-Patchwork-Id: 2473661 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 0DC0F3FD40 for ; Mon, 22 Apr 2013 19:55:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755197Ab3DVTzV (ORCPT ); Mon, 22 Apr 2013 15:55:21 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:57873 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754961Ab3DVTzU (ORCPT ); Mon, 22 Apr 2013 15:55:20 -0400 Received: by mail-wi0-f178.google.com with SMTP id hm14so1871345wib.5 for ; Mon, 22 Apr 2013 12:55:19 -0700 (PDT) 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:in-reply-to :references; bh=0CkX3bjb744ZwL+mYNKBd2cF6bUSU8wlEbhPIGCtAok=; b=KrfLb8t8tkWEOlaQYOaouQ4JT1UrCZtAXaAo32q4pAEDNiZUPyyNilNJimPq4KFMKj 8TEeE3saVB7z4NFaHXzvLoS1WQR+SNlK66n+q1pZOxKFpJid6r6r0Y+uwQd34+fjMAR3 dCCH0efm3kdAyK2pFsisXbUZXhtmsR+qcc/3RmCsXpNanUY8rolLsgCbsMnO/kV5oBpj tikGCsdZtbgO/M/1hKOqmjv4FD9B3wKAxkAQ44CjU49tVZUDTYYCwW8y663Y5W8p8gSy 3eU0wzNwngTKP+Ywzwkqwzqeuerv242QMYF91rvcDugfba8j7wDlnm+wIviOzaA+I49z yIPg== X-Received: by 10.180.107.6 with SMTP id gy6mr17579753wib.22.1366660519262; Mon, 22 Apr 2013 12:55:19 -0700 (PDT) Received: from gandalf.schnuecks.de (p5DE8E923.dip0.t-ipconnect.de. [93.232.233.35]) by mx.google.com with ESMTPS id w51sm42753704eev.13.2013.04.22.12.55.18 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Apr 2013 12:55:18 -0700 (PDT) Received: by gandalf.schnuecks.de (Postfix, from userid 500) id D713740156; Mon, 22 Apr 2013 21:55:17 +0200 (CEST) From: Simon Baatz To: linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org Cc: jason@lakedaemon.net, andrew@lunn.ch, cjb@laptop.org, thomas.petazzoni@free-electrons.com Subject: [PATCH 1/3] mmc: mvsdio: Support inverted CD and WP GPIO lines Date: Mon, 22 Apr 2013 21:54:58 +0200 Message-Id: <1366660500-26835-2-git-send-email-gmbnomis@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1366660500-26835-1-git-send-email-gmbnomis@gmail.com> References: <1366660500-26835-1-git-send-email-gmbnomis@gmail.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org The slot-gpio helper functions allow to specify whether card detect and write protect GPIO lines are active high or active low. Since DT allows to specify active low/high for GPIO lines as well, we can simply initialize the flags for slot-gpio using the GPIO flags to support all cases. We need to adapt the dts files that use CD/WP via GPIO accordingly. Only the dts for "MPL CEC4" is affected by this change. Signed-off-by: Simon Baatz --- arch/arm/boot/dts/kirkwood-mplcec4.dts | 2 +- drivers/mmc/host/mvsdio.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/kirkwood-mplcec4.dts b/arch/arm/boot/dts/kirkwood-mplcec4.dts index 7588241..bf3a58c 100644 --- a/arch/arm/boot/dts/kirkwood-mplcec4.dts +++ b/arch/arm/boot/dts/kirkwood-mplcec4.dts @@ -136,7 +136,7 @@ pinctrl-0 = <&pmx_sdio &pmx_sdio_cd>; pinctrl-names = "default"; status = "okay"; - cd-gpios = <&gpio1 15 0>; + cd-gpios = <&gpio1 15 1>; /* No WP GPIO */ }; }; diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c index 145cdaf..d444efd 100644 --- a/drivers/mmc/host/mvsdio.c +++ b/drivers/mmc/host/mvsdio.c @@ -691,6 +691,7 @@ static int __init mvsd_probe(struct platform_device *pdev) struct resource *r; int ret, irq; int gpio_card_detect, gpio_write_protect; + enum of_gpio_flags gpio_flags; struct pinctrl *pinctrl; r = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -731,8 +732,17 @@ static int __init mvsd_probe(struct platform_device *pdev) } host->base_clock = clk_get_rate(host->clk) / 2; - gpio_card_detect = of_get_named_gpio(np, "cd-gpios", 0); - gpio_write_protect = of_get_named_gpio(np, "wp-gpios", 0); + gpio_card_detect = of_get_named_gpio_flags(np, "cd-gpios", 0, + &gpio_flags); + if (gpio_is_valid(gpio_card_detect) && + !(gpio_flags & OF_GPIO_ACTIVE_LOW)) + mmc->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH; + + gpio_write_protect = of_get_named_gpio_flags(np, "wp-gpios", 0, + &gpio_flags); + if (gpio_is_valid(gpio_write_protect) && + !(gpio_flags & OF_GPIO_ACTIVE_LOW)) + mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; } else { const struct mvsdio_platform_data *mvsd_data; mvsd_data = pdev->dev.platform_data;