From patchwork Wed Apr 10 09:13:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Kleine-Budde X-Patchwork-Id: 2419971 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 F32C1DF2E5 for ; Wed, 10 Apr 2013 09:14:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936078Ab3DJJOD (ORCPT ); Wed, 10 Apr 2013 05:14:03 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:59346 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936027Ab3DJJOA (ORCPT ); Wed, 10 Apr 2013 05:14:00 -0400 Received: from gallifrey.ext.pengutronix.de ([2001:6f8:1178:4:5054:ff:fe8d:eefb] helo=hardanger.do.blackshift.org) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1UPr6D-0007pG-IE; Wed, 10 Apr 2013 11:13:49 +0200 From: Marc Kleine-Budde To: linux-mmc@vger.kernel.org Cc: kernel@pengutronix.de, cjb@laptop.org, Marc Kleine-Budde Subject: [PATCH v3 1/3] mmc: mxs-mmc: add cd-inverted property Date: Wed, 10 Apr 2013 11:13:43 +0200 Message-Id: <1365585225-11360-2-git-send-email-mkl@pengutronix.de> X-Mailer: git-send-email 1.8.2.rc2 In-Reply-To: <1365585225-11360-1-git-send-email-mkl@pengutronix.de> References: <1365585225-11360-1-git-send-email-mkl@pengutronix.de> X-SA-Exim-Connect-IP: 2001:6f8:1178:4:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-mmc@vger.kernel.org Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org The card-detect GPIO is inverted on some boards. Handle such case. Acked-by: Shawn Guo Signed-off-by: Marc Kleine-Budde --- drivers/mmc/host/mxs-mmc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c index 4efe302..0cdf1f6 100644 --- a/drivers/mmc/host/mxs-mmc.c +++ b/drivers/mmc/host/mxs-mmc.c @@ -72,6 +72,7 @@ struct mxs_mmc_host { int sdio_irq_en; int wp_gpio; bool wp_inverted; + bool cd_inverted; }; static int mxs_mmc_get_ro(struct mmc_host *mmc) @@ -96,7 +97,7 @@ static int mxs_mmc_get_cd(struct mmc_host *mmc) struct mxs_ssp *ssp = &host->ssp; return !(readl(ssp->base + HW_SSP_STATUS(ssp)) & - BM_SSP_STATUS_CARD_DETECT); + BM_SSP_STATUS_CARD_DETECT)) ^ host->cd_inverted; } static void mxs_mmc_reset(struct mxs_mmc_host *host) @@ -691,6 +692,8 @@ static int mxs_mmc_probe(struct platform_device *pdev) if (flags & OF_GPIO_ACTIVE_LOW) host->wp_inverted = 1; + host->cd_inverted = of_property_read_bool(np, "cd-inverted"); + mmc->f_min = 400000; mmc->f_max = 288000000; mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;