From patchwork Tue Jan 2 04:25:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 123089 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp8553725qgn; Mon, 1 Jan 2018 20:50:41 -0800 (PST) X-Google-Smtp-Source: ACJfBotDSwRA7vEbAEN8Cf7yiI2eJDQVeb2Pp2C1BhL0UJs93zPt8RTxCalvanIDFw0VWOAoLjsT X-Received: by 10.80.213.22 with SMTP id u22mr60583419edi.270.1514868641401; Mon, 01 Jan 2018 20:50:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514868641; cv=none; d=google.com; s=arc-20160816; b=QeawKwl5rCj98/kPVewVJIni97xrwpPes2dpcDqgT9FGdpbA4ZbLfg7/C4392yKRhr PmbGEs6eNe8R9XI61SY8kfmQf9VawM7IMud3ifjhAM8+G8eqz7runW2Tx7T6py4O7JKC +eysHtPBDWC/Mm4Oyr/V9zG84pA6EQkIiWcpNkQ7pxap+iPI3jheCBj3PWvKYWbx4Vxo 8uPHgHIpWowo4uw5UO75Lj3h9+toi6e0AY/PTkWqtaxn8c2SJ3IGArZ1avjis+yxdpRu H2DjmWIbH9eauN79wGjabki38SgMaLcsmeX1V1SUAF4FvHXUmPwk5CkAuB62UAjL3mQa nUjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=ZInlVwOorxOMXoiXfDWDtYJMXLYF96PymRboeln8oow=; b=lnW6W3StJ1X0tTvlSBKqlHqfcaz2j5c3iRV46K6/o5udWnhfovjlws9amGoNkzoJoi YfLgxiHN9+DsEPag7LFBNUGNQ5UkIo7VsGXLMHjELhsSwzqFMNXJRLLM+A2xv6UA0VlP MGm0TpWsTEhT/a/7dxxxG4as69zJEQH9onIisWpAkjbrdCgIkdXxTstQg+8PKEKVkF/7 HHBlzaXrvgm5ATOwIUBY7Q8y3IyrCJqHEhV8gHia6BH/ILI4aqNwNicFzzDbvYzV0Gnk VGiTSX1CxNm9sfOVxWFbBhj7qu9rF1LXiCLS0F5GOTt7ieSwNgZ/xk8rEp3EbMnvZVCh S11Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MxabeHOo; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 96si4017437edr.280.2018.01.01.20.50.40; Mon, 01 Jan 2018 20:50:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MxabeHOo; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 94E69C21DF0; Tue, 2 Jan 2018 04:50:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 93B13C21C34; Tue, 2 Jan 2018 04:50:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 294C2C21C29; Tue, 2 Jan 2018 04:35:18 +0000 (UTC) Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by lists.denx.de (Postfix) with ESMTPS id 71CB1C21C34 for ; Tue, 2 Jan 2018 04:35:17 +0000 (UTC) Received: by mail-pf0-f195.google.com with SMTP id n6so25241588pfa.4 for ; Mon, 01 Jan 2018 20:35:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=rNEMj/T+Dqs/k292Ptk6n9qj9JMTHpJc4YswJvEy9R4=; b=MxabeHOoOWII/SgOT5uPBRJOr5JmUffnz9U+MtQS6CsJx7CgLEiv7aCs8zd+vI6vcm p03bMw3oV0hJBebp7YHvKPS2zvCPiEw5XDOhwrfRMUO6KcNUqr1PooE9ihlvqhOP79RZ xIx0MKb4tvYOhxpfcbjLjKaTh5apPLxjfTY3o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=rNEMj/T+Dqs/k292Ptk6n9qj9JMTHpJc4YswJvEy9R4=; b=LcC9MA8eccoThoQCAlQ97avu7susdub0+UQ1Jz0DRm4cW4dI0rYeYsQzA5OJEBtyrF SKFg7ZDZw5eQ5ECNCIRaK7QNDSHiPXtAUXQmk/+4ritHjD69DQrEnvmipHnDCuyOFRZ3 vmeM0GZ5Z9Gt1OgGfpSfe59FOovmT9yuP0VF2OisYGiVzni+sFpAQhQYsuP6wQQfI6uy dbGesljyBGuFhcwYT40Tsgjw3Aj469x1J1682FILQdff25KQxUSjNoGFmGYjwsCXRLk4 iKIM0ny8VvyXfywtS2WRosmPxek2WKyW1vf/OBXKvQypjAjKGJ7sVkQqpxbKhlvePIky umzw== X-Gm-Message-State: AKGB3mK/25TnGHF41DxzJJiQp7wkU4rO74q59U51VORvGZaBIdPMBBJK 2ShmSY/RiWWP2oj7bcSvXrLQAQ== X-Received: by 10.99.98.198 with SMTP id w189mr38400964pgb.328.1514867715878; Mon, 01 Jan 2018 20:35:15 -0800 (PST) Received: from localhost.localdomain (61-216-91-114.HINET-IP.hinet.net. [61.216.91.114]) by smtp.gmail.com with ESMTPSA id c184sm48158383pfc.8.2018.01.01.20.35.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Jan 2018 20:35:14 -0800 (PST) From: Jun Nie To: sjg@chromium.org, jjhiblot@ti.com, maxime.ripard@free-electrons.com, trini@konsulko.com Date: Tue, 2 Jan 2018 12:25:57 +0800 Message-Id: <1514867157-18907-1-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 X-Mailman-Approved-At: Tue, 02 Jan 2018 04:50:34 +0000 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH] mmc: Poll for broken card detection case X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Poll for broken card detection case instead of return no card detected. Signed-off-by: Jun Nie --- drivers/mmc/Kconfig | 5 +++++ drivers/mmc/mmc.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index 8fbeaa7..ed194a3 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -10,6 +10,11 @@ config MMC If you want MMC/SD/SDIO support, you should say Y here and also to your specific host controller driver. +config MMC_BROKEN_CD + bool "Poll for broken card detection case" + help + If card detection feature is broken, just poll to detect. + config DM_MMC bool "Enable MMC controllers using Driver Model" depends on DM diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 38d2e07..13c5bf5 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1650,8 +1650,12 @@ int mmc_start_init(struct mmc *mmc) bool no_card; int err; +#if !defined(CONFIG_MMC_BROKEN_CD) /* we pretend there's no card when init is NULL */ no_card = mmc_getcd(mmc) == 0; +#else + no_card = 0; +#endif #if !CONFIG_IS_ENABLED(DM_MMC) no_card = no_card || (mmc->cfg->ops->init == NULL); #endif