From patchwork Wed Apr 10 09:13:45 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: 2419951 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 92E66DFE76 for ; Wed, 10 Apr 2013 09:14:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936055Ab3DJJNz (ORCPT ); Wed, 10 Apr 2013 05:13:55 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:59340 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936046Ab3DJJNx (ORCPT ); Wed, 10 Apr 2013 05:13:53 -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 1UPr6E-0007pG-Ct; Wed, 10 Apr 2013 11:13:50 +0200 From: Marc Kleine-Budde To: linux-mmc@vger.kernel.org Cc: kernel@pengutronix.de, cjb@laptop.org, Hector Palacios , Marc Kleine-Budde Subject: [PATCH v3 3/3] mmc: mxs-mmc: add broken-cd property Date: Wed, 10 Apr 2013 11:13:45 +0200 Message-Id: <1365585225-11360-4-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 From: Hector Palacios According to bindings documentation for mmc, the property 'broken-cd' can be used to indicate card-detection is not available and polling must be used instead. This patch retrieves this property and sets a custom flag. On the get_cd() hook, it returns 1 if the flag is set, to always assume the card is present. Signed-off-by: Hector Palacios Signed-off-by: Marc Kleine-Budde --- drivers/mmc/host/mxs-mmc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c index c231881..146a53b 100644 --- a/drivers/mmc/host/mxs-mmc.c +++ b/drivers/mmc/host/mxs-mmc.c @@ -73,6 +73,7 @@ struct mxs_mmc_host { int wp_gpio; bool wp_inverted; bool cd_inverted; + bool broken_cd; bool non_removable; }; @@ -97,7 +98,7 @@ static int mxs_mmc_get_cd(struct mmc_host *mmc) struct mxs_mmc_host *host = mmc_priv(mmc); struct mxs_ssp *ssp = &host->ssp; - return host->non_removable || + return host->non_removable || host->broken_cd || !(readl(ssp->base + HW_SSP_STATUS(ssp)) & BM_SSP_STATUS_CARD_DETECT) ^ host->cd_inverted; } @@ -689,6 +690,7 @@ static int mxs_mmc_probe(struct platform_device *pdev) mmc->caps |= MMC_CAP_4_BIT_DATA; else if (bus_width == 8) mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA; + host->broken_cd = of_property_read_bool(np, "broken-cd"); host->non_removable = of_property_read_bool(np, "non-removable"); if (host->non_removable) mmc->caps |= MMC_CAP_NONREMOVABLE;