From patchwork Sun Mar 3 13:05:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Otavio Salvador X-Patchwork-Id: 224542 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id F2A372C030C for ; Mon, 4 Mar 2013 00:00:25 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 868554A033; Sun, 3 Mar 2013 14:00:19 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JTptnQ5nBpnB; Sun, 3 Mar 2013 14:00:19 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 270024A036; Sun, 3 Mar 2013 14:00:13 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2062C4A027 for ; Sun, 3 Mar 2013 14:00:09 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jpF6l2IVUZ5N for ; Sun, 3 Mar 2013 14:00:06 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ye0-f173.google.com (mail-ye0-f173.google.com [209.85.213.173]) by theia.denx.de (Postfix) with ESMTPS id 7A8F94A020 for ; Sun, 3 Mar 2013 14:00:05 +0100 (CET) Received: by mail-ye0-f173.google.com with SMTP id l14so667986yen.4 for ; Sun, 03 Mar 2013 05:00:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=uWRBu5Jagqw6OR62sa3TIqnMPNXYiyWtc2VzFQ7dU3o=; b=Na7GSNvJrKUZOg/NbGJxW+JS7vB95ih6fY1iQd41UJLWjaX+4Hr3C2vGyDXgwR7K68 KW+ID3NwDOrYrDmqKmvaiRB51kMjeJPpsPJlHUx9fL+QC1AApqeAfSRfS6dugps+x9Vh 5+i4Zp/Eu8PkcnJO24MaCXu6wdkFOaYMCm7bDrKT7DsQxvPNY+9xawBSxVeCINTEJI4n bHtM00EkPfXJhIUIDUUnyzSykkVjKMSPY0ZFDSNZ/zES9CEMixPkLUOUIkPqVBivFDQH 8g+fCuSB9XxFMVqQEABYoASP6S/hOZ9xXSzMR+MOhE7tkh+nk0b9JMz1gHG3mh6BvTHX sTVQ== X-Received: by 10.236.149.74 with SMTP id w50mr11848191yhj.129.1362315602911; Sun, 03 Mar 2013 05:00:02 -0800 (PST) Received: from nano.lab.ossystems.com.br ([187.23.144.59]) by mx.google.com with ESMTPS id x8sm29401887yhn.12.2013.03.03.05.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 03 Mar 2013 05:00:02 -0800 (PST) From: Otavio Salvador To: U-Boot Mailing List Date: Sun, 3 Mar 2013 10:05:10 -0300 Message-Id: <1362315912-11170-2-git-send-email-otavio@ossystems.com.br> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1362315912-11170-1-git-send-email-otavio@ossystems.com.br> References: <1362315912-11170-1-git-send-email-otavio@ossystems.com.br> Cc: Fabio Estevam , Otavio Salvador Subject: [U-Boot] [PATCH v2 1/3] mx6qsabresd: Fix card detection for invalid card id case X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This changes the code so in case an unkown value is passed it will return as invalid. Signed-off-by: Otavio Salvador --- Changes in v2: - Rework code to use a 'ret' variable (Fabio) board/freescale/mx6qsabresd/mx6qsabresd.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/board/freescale/mx6qsabresd/mx6qsabresd.c b/board/freescale/mx6qsabresd/mx6qsabresd.c index 65c4a1a..e556476 100644 --- a/board/freescale/mx6qsabresd/mx6qsabresd.c +++ b/board/freescale/mx6qsabresd/mx6qsabresd.c @@ -145,15 +145,18 @@ struct fsl_esdhc_cfg usdhc_cfg[3] = { int board_mmc_getcd(struct mmc *mmc) { struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; + int ret = 0; switch (cfg->esdhc_base) { case USDHC2_BASE_ADDR: - return !gpio_get_value(USDHC2_CD_GPIO); + ret = !gpio_get_value(USDHC2_CD_GPIO); case USDHC3_BASE_ADDR: - return !gpio_get_value(USDHC3_CD_GPIO); - default: - return 1; /* eMMC/uSDHC4 is always present */ + ret = !gpio_get_value(USDHC3_CD_GPIO); + case USDHC4_BASE_ADDR: + ret = 1; /* eMMC/uSDHC4 is always present */ } + + return ret; } int board_mmc_init(bd_t *bis)