From patchwork Tue Apr 19 15:54:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Meduna X-Patchwork-Id: 8881401 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 970A19F36E for ; Tue, 19 Apr 2016 15:56:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AC77620251 for ; Tue, 19 Apr 2016 15:56:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C2E94201E4 for ; Tue, 19 Apr 2016 15:56:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1asXzK-0006Rz-08; Tue, 19 Apr 2016 15:54:54 +0000 Received: from snxtleo0111.nxtcontrol.com ([91.118.38.52] helo=smtp.nxtcontrol.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1asXzG-0006Fp-CZ for linux-arm-kernel@lists.infradead.org; Tue, 19 Apr 2016 15:54:52 +0000 Received: from localhost (localhost [127.0.0.1]) by smtp.nxtcontrol.com (Postfix) with ESMTP id 1DFA8A0659; Tue, 19 Apr 2016 17:54:20 +0200 (CEST) Received: from smtp.nxtcontrol.com ([127.0.0.1]) by localhost (snxtleo0125.nxtcontrol.lan [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id xGGqd7EM9bV6; Tue, 19 Apr 2016 17:54:20 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by smtp.nxtcontrol.com (Postfix) with ESMTP id E3B6BA5BE2; Tue, 19 Apr 2016 17:54:19 +0200 (CEST) X-Virus-Scanned: amavisd-new at nxtcontrol.lan Received: from smtp.nxtcontrol.com ([127.0.0.1]) by localhost (snxtleo0125.nxtcontrol.lan [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id IulE5F6gByKI; Tue, 19 Apr 2016 17:54:19 +0200 (CEST) Received: from [192.168.130.22] (78-141-77-45.dynamic.orange.sk [78.141.77.45]) by smtp.nxtcontrol.com (Postfix) with ESMTPSA id 8D070A0659; Tue, 19 Apr 2016 17:54:19 +0200 (CEST) Subject: Re: i.MX53 restart via watchdog does not work To: "linux-arm-kernel@lists.infradead.org" References: <57111429.6040802@nxtcontrol.com> From: Stanislav Meduna Message-ID: <571654B0.6040203@nxtcontrol.com> Date: Tue, 19 Apr 2016 17:54:24 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160419_085450_841236_00FD45D6 X-CRM114-Status: GOOD ( 18.75 ) X-Spam-Score: -2.9 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shawn Guo , Fabio Estevam , Sascha Hauer Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 4/19/2016 5:39 PM, Fabio Estevam wrote: >> I am using an TQMa53 board, which expects to be resetted >> by watchdog circuit. In older kernels ths was done in >> by mxc_restart defined in arch/arm/mach-imx/system.c >> and initialized and wired in mach-imx53.c. >> >> Current kernels however do not use this and the mach-imx53.c >> does not set .restart. I am getting >> imx2-wdt 53f98000.wdog: Device shutdown: Expect reboot! >> reboot: Restarting system >> and the system just hangs there. > > I am able to reproduce this issue on a imx6ul-evk board. > > It works fine on a imx6q sabresd board though. After much head-scratching I was able to isolate the problem. In fact it has nothing to do with the watchdog or at least not directly. The reset is now located in the watchdog code itself and gets called normally (which I have overlooked when writing the original message). The probable culprit is the eMMC card being left in some state that the bootloader cannot handle. For now I worked around it using the patch below (4.4-based), using a device tree property to prevent the card from sleeping in _mmc_suspend. I'm not really sure what the 3.9 kernel does differently here though... Could you try to jump around the mmc_sleep(host) call in _mmc_suspend to see whether it fixes the problem also for you? Regards Stano commit a130df68e1c7770fa8ffc807fe40931615d2383a Author: Stanislav Meduna Date: Mon Apr 18 19:19:28 2016 +0200 mmc: disable card sleep via device-tree On a TQMa53 module the mmc_sleep leaves the eMMC card in a state that (probably) the U-Boot is unable to probe, resulting in reboot hanging. Add a device tree property to disable sleeping on suspend. diff --git a/Documentation/devicetree/bindings/mmc/mmc-card.txt b/Documentation/devicetree/bindings/mmc/mmc-card.txt index a70fcd6..776a17333 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: diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 3d5087b..6506617 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -357,7 +357,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")) + { 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); /* @@ -1824,7 +1828,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 eb0151b..e1d275d 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -313,6 +313,7 @@ struct mmc_card { struct dentry *debugfs_root; struct mmc_part part[MMC_NUM_PHY_PARTITION]; /* physical partitions */ unsigned int nr_parts; + bool no_sleep_on_suspend; }; /*