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: 2473691 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 5AEC3DF23A for ; Mon, 22 Apr 2013 19:56:01 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UUMpx-000236-V9; Mon, 22 Apr 2013 19:55:42 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UUMpr-0000od-PL; Mon, 22 Apr 2013 19:55:35 +0000 Received: from mail-wg0-x235.google.com ([2a00:1450:400c:c00::235]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UUMpf-0000nG-I4 for linux-arm-kernel@lists.infradead.org; Mon, 22 Apr 2013 19:55:26 +0000 Received: by mail-wg0-f53.google.com with SMTP id z11so1162787wgg.8 for ; Mon, 22 Apr 2013 12:55:21 -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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130422_155523_780445_9F37BE12 X-CRM114-Status: GOOD ( 13.08 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (gmbnomis[at]gmail.com) -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: thomas.petazzoni@free-electrons.com, andrew@lunn.ch, cjb@laptop.org, jason@lakedaemon.net 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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;