Received: by 10.192.165.148 with SMTP id m20csp2756332imm; Sun, 22 Apr 2018 14:36:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx481nuKxb5DR6d1Dc7oS0AfWXQgYpdTJ9FdkHfKXuw2Fx5cMukf3dRvm3o+Ov9d20nGJTiTR X-Received: by 10.101.72.201 with SMTP id o9mr14714540pgs.390.1524432961904; Sun, 22 Apr 2018 14:36:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524432961; cv=none; d=google.com; s=arc-20160816; b=nlrBlgkvFk5ksWa3ESlKmxK1bxM/NeIXio9sekkyV/zcIKWQR9L4/97hJNw+bzfINf qEw03zzJAsEbE8lJJH4Qcvd0M+UfLMTjH1EIqPTUuLX6haZAzgzF0R+Qx19hHEPssEQ4 P5M5+vEZ9l9mPAtLLDIsYHLaf5gb3bdSlVNd47zjbyrK/C67hYah/QnWdfWx1zhui6DG MBKx6eGwQGfU/q5EeW2R4U7lKEsov3A8UIP4m3E9+9evSv0wOO4tDBSPWh9O0DPFkWeA nO2CzavWjFU0h0EZYf8TVkRoLg9tWgn6iO3Zt9Mdelj62vbcuk9Gvm0cYukDql/iHq9P 79jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=kzMa3HLNtg+xRA7LXDTBq/gTKsx3EgVCjp2uxYx6aB8=; b=DLcg+Z+iZqAXltObtu08ZZ3AzsIGrV7l7Ghqbw5zfixpkYy67W/Vw7R5O4A3NIQo0P kTolNSUdsgMhHfpOS5z/XK6Jsf3Ztr2p8AjS9e2c1Yy/HeT6yn2bxGCDFN3XhoP0lrvz 2u6RzY0y0pELWgDPT8PzTgL4NuDVm7JPnP0mYn2NNubCORV4/n7shdEMLulpV6N3zT0M uefSGA03E/0XecHcWAIRHkeqoeXpwj239fp+CXJmaK6y5GyqLvmoKdg7hFQzv+6Olq1a qhRu5QpNUuyTQcOrpsGaOLzl7ykoXPNmkOC8UKAgwlSKCtoQOZJgvNFR6TGxbtzHn7r5 rmAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k5-v6si11256579pln.598.2018.04.22.14.35.15; Sun, 22 Apr 2018 14:36:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753652AbeDVVb6 (ORCPT + 99 others); Sun, 22 Apr 2018 17:31:58 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:41029 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753537AbeDVVb4 (ORCPT ); Sun, 22 Apr 2018 17:31:56 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 40TjTh49yBz1r1NF; Sun, 22 Apr 2018 23:31:52 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 40TjTh1qdCz1qqkn; Sun, 22 Apr 2018 23:31:52 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id bQZytQgYRage; Sun, 22 Apr 2018 23:31:50 +0200 (CEST) X-Auth-Info: y6ZpvazWcN6izYQiac+KYbeGqY+1D3rDv928aZ3B5oA= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sun, 22 Apr 2018 23:31:50 +0200 (CEST) From: Lukasz Majewski To: Ulf Hansson , Linus Walleij , linux-kernel@vger.kernel.org Cc: Rob Herring , Mark Rutland , Adrian Hunter , Fabio Estevam , Wolfram Sang , Chanho Min , devicetree@vger.kernel.org, linux-mmc@vger.kernel.org, Stanislav Meduna , Lukasz Majewski Subject: [PATCH] mmc: disable card sleep via device-tree Date: Sun, 22 Apr 2018 23:31:26 +0200 Message-Id: <20180422213126.32756-1-lukma@denx.de> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stanislav Meduna On a TQMa53 module the mmc_sleep leaves the eMMC card in a state that the imx53 rom boot code is unable to probe, resulting in reboot hanging. Add a device tree property to disable sleeping on suspend. For TQMa53 modules the exact commit to cause hang after reboot (v3.10 -> v3.11): commit 486fdbbc1483 ("mmc: core: Add shutdown callback for (e)MMC bus_ops") [The exact discussion can be found here: https://patchwork.kernel.org/patch/8881401/ "i.MX53 restart via watchdog does not work" Signed-off-by: Stanislav Meduna Signed-off-by: Lukasz Majewski --- Documentation/devicetree/bindings/mmc/mmc-card.txt | 4 ++++ drivers/mmc/core/mmc.c | 7 +++++-- include/linux/mmc/card.h | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/mmc/mmc-card.txt b/Documentation/devicetree/bindings/mmc/mmc-card.txt index 8d2d71758907..c3ee151edd7c 100644 --- a/Documentation/devicetree/bindings/mmc/mmc-card.txt +++ b/Documentation/devicetree/bindings/mmc/mmc-card.txt @@ -12,6 +12,9 @@ Required properties: Optional properties: -broken-hpi : Use this to indicate that the mmc-card has a broken hpi implementation, and that hpi should not be used +-no-sleep-on-suspend : Do not put the card to sleep when suspending. + There are boards with bootloaders that are unable + to probe such card when rebooting. Example: @@ -26,5 +29,6 @@ Example: reg = <0>; compatible = "mmc-card"; broken-hpi; + no-sleep-on-suspend; }; }; diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 208a762b87ef..a3b74b5c8893 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -381,8 +381,11 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd) } np = mmc_of_find_child_device(card->host, 0); - if (np && of_device_is_compatible(np, "mmc-card")) + if (np && of_device_is_compatible(np, "mmc-card")) { broken_hpi = of_property_read_bool(np, "broken-hpi"); + card->no_sleep_on_suspend = + of_property_read_bool(np, "no-sleep-on-suspend"); + } of_node_put(np); /* @@ -1990,7 +1993,7 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend) if (mmc_can_poweroff_notify(host->card) && ((host->caps2 & MMC_CAP2_FULL_PWR_CYCLE) || !is_suspend)) err = mmc_poweroff_notify(host->card, notify_type); - else if (mmc_can_sleep(host->card)) + else if (mmc_can_sleep(host->card) && !host->card->no_sleep_on_suspend) err = mmc_sleep(host); else if (!mmc_host_is_spi(host)) err = mmc_deselect_cards(host); diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 279b39008a33..c64d88e6de3b 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -304,8 +304,8 @@ struct mmc_card { struct dentry *debugfs_root; struct mmc_part part[MMC_NUM_PHY_PARTITION]; /* physical partitions */ unsigned int nr_parts; - unsigned int bouncesz; /* Bounce buffer size */ + bool no_sleep_on_suspend; }; static inline bool mmc_large_sector(struct mmc_card *card) -- 2.11.0