From patchwork Thu Dec 2 16:30:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cooper X-Patchwork-Id: 12694536 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 F23FFC433EF for ; Thu, 2 Dec 2021 16:32:22 +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:References:In-Reply-To: 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: List-Owner; bh=O5MI+D46hE2RwTfspu4yhZLoIZtgomie7W+4Bzk2YmY=; b=PYEfJendqOxQE2 SIToEhj3fWsGngwtmrPL/vo9idghxA64HnOu6ojh9T5dSj4nfY2s78ff2EF/H0Jcuxzsfa5akcc2h b08/39m868VPipvlxW4wXxrDXfQJKXiuFxIMigkIOejRgTLzAcg6rg3mVYuDODxU+qIO5/ipYgsfz 9o/S/73UMsB4DCpmml1cMqfSUCjvYq1lRHoiqvXvQ2kvZdcCgVQkjMmN2mdovrCBndTHVsirVRtJq kkhcQlVeyllMPEhKtwI1y0Q3z4wojgltOPAs4MzWiYow74NZyA1O/JNozBGFwkz0UzLDUKv3X3m+6 xpkfIbVYIUEIj0+L+w3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1msozE-00D28L-O9; Thu, 02 Dec 2021 16:31:08 +0000 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1msoz3-00D25n-1z for linux-arm-kernel@lists.infradead.org; Thu, 02 Dec 2021 16:30:58 +0000 Received: by mail-pj1-x102b.google.com with SMTP id gx15-20020a17090b124f00b001a695f3734aso231808pjb.0 for ; Thu, 02 Dec 2021 08:30:56 -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:in-reply-to:references; bh=85a8mtZKwmbAv3R4H4Wl42WbZw39ee4ytKJ8//L9jFk=; b=XnKuPawCFmMShML0W9PaeKTDrWlbQ1dprewSJDxyZN8OwzeVusLpyCACzdl52RzRFb HKtJNlyFtrJOokg1VvHdmDOhWeyBqpfoTQ/5yNxys2NqhvFayFKYBHu2IUZhU/3bjW1D qy5rDer2UD6BqE7sFz/opXf0XpgWP++Fpl9Wqrula3MsSL961DHWb11JRyYWa2qixFxL Ak5XnzDG2ARH4pNj2ggAqseK2HebeFhrjmI8C+nTtYs/R5EdKeEm3NVhCTqtkcW2gDAs ZlIAs5TzoSXoIw0gbtVPILwJInihPmJfRK8y9HUxZTSpeIgZhDgLtx0k7AHOzHau2TBy LTUw== 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:in-reply-to :references; bh=85a8mtZKwmbAv3R4H4Wl42WbZw39ee4ytKJ8//L9jFk=; b=Jq4nGCfdLyMrCrKCOsdhrt1KDNId4gv3OjHYjg5IzJizVavmnSVskiPCmXMH8e0BLA rc/bW4nc8cYrGJszbcMmckvMFQ596Ax+LYJkWryBa2nOVk2T0sBtcMcMzmznFvQiw79d v7HLHvQlC99KXa95E9588lzHMG/03ecrSrrRJ4ZhwDpoa5coHDNR8SlG4djuYDA42SzX jT7hYmYdJT0PMy+78vn+I4y4z4XFgr/uiAFY9rZJQdwnNLEu5Au2guQYyblR58RQFK/d aWMEQ6N6080XUykxzjPXoq1XgYLohNCpUoxuWJvYy9lu+IxjZUswVbWI05myUIH8b5LP +NpA== X-Gm-Message-State: AOAM533xZzg3UlAjt1GPa3t5AJtebSnDsBAdUuYWzi0ZZpeb3OIO47JW AXh5BEa2ESL+oc42ylVuU/o= X-Google-Smtp-Source: ABdhPJx9Gth86hMxgCffQtyxPvM2JSuqf6LD4YfY/tyo9NPyUxuteeCtP2Bo6lclCO57tNPOA/npug== X-Received: by 2002:a17:90b:3b4c:: with SMTP id ot12mr7180561pjb.196.1638462656256; Thu, 02 Dec 2021 08:30:56 -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.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 08:30:55 -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 2/2] mmc: sdhci-brcmstb: "mmc1: Internal clock never stabilised." seen on 72113 Date: Thu, 2 Dec 2021 11:30:50 -0500 Message-Id: <20211202163050.46810-2-alcooperx@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211202163050.46810-1-alcooperx@gmail.com> References: <20211202163050.46810-1-alcooperx@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211202_083057_124578_063DFCDE X-CRM114-Status: GOOD ( 17.44 ) 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: 5b191dcba719 ("mmc: sdhci-brcmstb: Fix mmc timeout errors on S5 suspend") Signed-off-by: Al Cooper Acked-by: Florian Fainelli --- drivers/mmc/host/sdhci-brcmstb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c index f24623aac2db..11037cd14cfa 100644 --- a/drivers/mmc/host/sdhci-brcmstb.c +++ b/drivers/mmc/host/sdhci-brcmstb.c @@ -313,6 +313,10 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev) static void sdhci_brcmstb_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); }