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); } 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); }