From patchwork Mon Mar 25 15:02:30 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: 2331651 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 B3C2B3FD8C for ; Mon, 25 Mar 2013 15:03:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932097Ab3CYPCy (ORCPT ); Mon, 25 Mar 2013 11:02:54 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:51530 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932101Ab3CYPCl (ORCPT ); Mon, 25 Mar 2013 11:02:41 -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 1UK8uz-0005xJ-A6; Mon, 25 Mar 2013 16:02:37 +0100 From: Marc Kleine-Budde To: linux-mmc@vger.kernel.org Cc: kernel@pengutronix.de, Chris Ball , linux-arm-kernel@lists.infradead.org, Shawn Guo , Marc Kleine-Budde Subject: [PATCH 1/2] mmc: mxs-mmc: add cd-inverted property Date: Mon, 25 Mar 2013 16:02:30 +0100 Message-Id: <1364223751-28253-2-git-send-email-mkl@pengutronix.de> X-Mailer: git-send-email 1.8.2.rc2 In-Reply-To: <1364223751-28253-1-git-send-email-mkl@pengutronix.de> References: <1364223751-28253-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. 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;