From patchwork Thu Dec 2 16:30:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cooper X-Patchwork-Id: 12694535 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8AA99C433F5 for ; Thu, 2 Dec 2021 16:32:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=VQ7CcEczrh5v2XH34AQiX1Lo4JM0yO0Y2Heui1zgZl0=; b=FPAd5WEEsmwT0U WHjH6UnY8PKwx8Hp0bP1RWEXTpiZ5Y9etgVZge0RwBmPFYRjUML/NlcQfWb0Zzsc5X8Cu0gskrJwL 7ShhYHKLqlP7/t0MoSp2N0xhekckmGiBXwfrRF9YqTgzw78LixTJLtK3g72DA9JhHDyHKkZYWwEHy /tPbZO89BNdNq3sbpU3JqcqJISr1NEB1xpUGj+2aV08mceddgF/8H7uzl4H2m8RpPrKlNZ6Ko0Kst AyDHLvBz0ozrepGmO8mWHbVrMqV/MgKR64s2qGhGLMMJ5MjZu8IOfnR7YaZUGbr+YoEaei8LIijlw IvDY3Z5Jy46iv9su/Uww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1msoz5-00D26J-GX; Thu, 02 Dec 2021 16:30:59 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1msoz1-00D25F-Ha for linux-arm-kernel@lists.infradead.org; Thu, 02 Dec 2021 16:30:56 +0000 Received: by mail-pf1-x433.google.com with SMTP id u80so44732pfc.9 for ; Thu, 02 Dec 2021 08:30:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=xfHD3PJp2+zpFPC6cbhXhGVotEkFSNwM4d8Y3uvqvg0=; b=bvHMQ6twxvxMP0xp97Qyk9rDJawkYDrlxG699ksGGP5WykjDH41hrVy6aEr7vnv4Ew BnsZD4MC0V9SC/NZPXCG2M0JDxP+pgKocPZXVEjlCcqcw1Lq+vaNIH5PONMGS+K2KRMz EiCeEqUDFFblNnRQAcT391w5ixAk7Dq+YUO/oEgX/vYnaQPNQ3PZo7Bo4FtBJiSVirok OG+ItU4RA0+w3agFro28kg6+BCFfwiZm8w0FgeC3Y+DSwafOmZXeeBo3QcRMYwVGUq1R 3gai9hYxCQkyI+u2GmE1Ed3r7Mf/d6AHaTQGdGCsFdag8ly+OvI4bjVTrEsP9WsLWmdC VNLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=xfHD3PJp2+zpFPC6cbhXhGVotEkFSNwM4d8Y3uvqvg0=; b=LM7qsKzYQZ5m7OBOmJHHWjf3peN9xam6DxPCBo/ibmTRhAFqkUVEDZcqhZZ4Xf2I7Z 4LOYRu+zDrFYdok8vriEri2h1dYFgwkuBdjMwPJpgIldmHTNyIZawrD1WsZXzubPA4ql +BOxNE+cBG9ZgttfXLhkTzvnAsomfVbDOPJyNptybpFqfjoRPQ27ugFdJph4smknkDLA VC/l9ip4ROhhMzNxsL6Gy1PVO+gGijdk0BYVFZkaXDnMqLEZEd/dNQPAPQKv+3/8MBDW kuDp/cASd/yhzBmN//AwcThcuyrRlV1aSVgSz28X+x0fjHt3lv6z/+ubeMPzxSQPxNhU gCqA== X-Gm-Message-State: AOAM532HLCAH8zS4fblf37j6Ote/FJM+dFUrcjHeYyaCFq+6qaRzta/K tW0TkHFhlvKR+M2t7S9Pl2U= X-Google-Smtp-Source: ABdhPJwa223cdCFhuD3uArlF69/2lcVEAW1qydhZ+mFj+8EtIfLpaSyjXeRASAblQFFR6B5tu3xuXg== X-Received: by 2002:a63:1945:: with SMTP id 5mr166781pgz.99.1638462654709; Thu, 02 Dec 2021 08:30:54 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id z10sm287368pfh.188.2021.12.02.08.30.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 08:30:54 -0800 (PST) From: Al Cooper To: linux-kernel@vger.kernel.org Cc: Al Cooper , Adrian Hunter , bcm-kernel-feedback-list@broadcom.com, Florian Fainelli , linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, Ray Jui , Scott Branden , Ulf Hansson Subject: [PATCH 1/2] mmc: sdhci-iproc: "mmc1: Internal clock never stabilised." seen on 72113 Date: Thu, 2 Dec 2021 11:30:49 -0500 Message-Id: <20211202163050.46810-1-alcooperx@gmail.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211202_083055_607457_6B01EBF7 X-CRM114-Status: GOOD ( 16.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The problem is in the .shutdown callback that was added to the sdhci-iproc and sdhci-brcmstb drivers to save power in S5. The shutdown callback will just call the sdhci_pltfm_suspend() function to suspend the lower level driver and then stop the sdhci system clock. The problem is that in some cases there can be a worker thread in the "system_freezable_wq" work queue that is scanning for a device every second. In normal system suspend, this queue is suspended before the driver suspend is called. In shutdown the queue is not suspended and the thread my run after we stop the sdhci clock in the shutdown callback which will cause the "clock never stabilised" error. The solution will be to have the shutdown callback cancel the worker thread before calling suspend (and stopping the sdhci clock). NOTE: This is only happening on systems with the Legacy RPi SDIO core because that's the only controller that doesn't have the presence signal and needs to use a worker thread to do a 1 second poll loop. Fixes: 98b5ce4c08ca ("mmc: sdhci-iproc: Add support for the legacy sdhci controller on the BCM7211") Signed-off-by: Al Cooper Acked-by: Florian Fainelli --- drivers/mmc/host/sdhci-iproc.c | 4 ++++ 1 file changed, 4 insertions(+) base-commit: 58e1100fdc5990b0cc0d4beaf2562a92e621ac7d diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c index 032bf852397f..05db768edcfc 100644 --- a/drivers/mmc/host/sdhci-iproc.c +++ b/drivers/mmc/host/sdhci-iproc.c @@ -428,6 +428,10 @@ static int sdhci_iproc_probe(struct platform_device *pdev) static void sdhci_iproc_shutdown(struct platform_device *pdev) { + struct sdhci_host *host = platform_get_drvdata(pdev); + + /* Cancel possible rescan worker thread */ + cancel_delayed_work_sync(&host->mmc->detect); sdhci_pltfm_suspend(&pdev->dev); }