Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3601075ioa; Tue, 26 Apr 2022 06:42:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxUTc8udGme5K3wJP+K+81F+8oF8UhqE4zh9mwoelcZ7xQm+4oAAcYCBZYImDVjg+Ca6mo X-Received: by 2002:a17:907:948b:b0:6d8:27f8:ab4a with SMTP id dm11-20020a170907948b00b006d827f8ab4amr20854424ejc.39.1650980577706; Tue, 26 Apr 2022 06:42:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650980577; cv=none; d=google.com; s=arc-20160816; b=wyPMkcdA+2NqvaRPtaml/pLKc1y66tanLceA5kOrw/42ViaKHJVr67E2KBCQsmD9Yb dQq5quAJeOXB0l/RtzxG45EvR8n4MaSNhmBSw+34oCtYu9egN/c1OZR63CwRBviqmzb9 j8XycJvadxJBVUNc6YvIgWFuyrv318w5Ns5Tl/OZF4s8aZ9MaD0ByMeYGps3KmYIDSuY pq3ufsJ7/0GPdX5Ha6UxM5NwsVYhhUbefYwzIbU/5OuBdAtv5xWrEckNv/TYr7eCGo8f Vv1vClIyzlDns6NXcxGpbjxk4LIeiLCpjX00uyeFxsFomLraWdvu674DfB8Jx/vAGeGZ xjeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8hkx/016NOmcH8uXfAANlu/SduPDDozUxUdBcGiJP5c=; b=CMbq9XjehMwF5XjaM6dhcGkcI0ycAqFWkmzeRY0kXOwinruMt0hTuDAsIuQgHuWRcL UGA7wJhWNEYVZzB0ob2juOKTz8rtfVDwr3LxrVSD6t2TmklFc0aA6AzceyBfgRKqQfAS 1Hf3bGX2HFmGYgLODDKc3ZknRvYw9Q85gjEBc94q5nctOpbH6BIREZv7zYxJqB2dzV9w iqoUgVZVCs63WJIUIGy2nFWSmWJcl/qk6ZnPudeuz3+yrp4oGgV7MUvhhakn6HghRMIp QSV9NFItrsUuCYZ2tEe246XZP/SQqo6LXdgCHJDCDzdCvdpXabDnfNcR6ZpNuGlRMjCA 5OQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ak+5OhYL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dc15-20020a170906c7cf00b006f3bceb2c9dsi464754ejb.858.2022.04.26.06.42.32; Tue, 26 Apr 2022 06:42:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ak+5OhYL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345858AbiDZJCo (ORCPT + 99 others); Tue, 26 Apr 2022 05:02:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346978AbiDZIpl (ORCPT ); Tue, 26 Apr 2022 04:45:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DD663EAA4; Tue, 26 Apr 2022 01:37:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 15014618E8; Tue, 26 Apr 2022 08:37:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C952C385A0; Tue, 26 Apr 2022 08:37:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650962224; bh=trXIu8XHmAnC0fElf80oY0FbsOH2cP1tf1pUgA0Dk4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ak+5OhYLG0tKpZduetAkXNGPyoyno32XENkH89pt/YYy0cglCFtTObQkgCq1XouKN UdoJ9z3sJzhW8MHSGwpyBUbzs3xYP86krv6f/8RvHKoB+2Vdgulu9Q72Pvti+GlkQn D/iKl1O1tFqSvS2kTIwzAcfG9OLUZdMKLtEm30Sw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Allen-KH Cheng , Rex-BC Chen , Mark Brown , Sasha Levin Subject: [PATCH 5.15 026/124] spi: spi-mtk-nor: initialize spi controller after resume Date: Tue, 26 Apr 2022 10:20:27 +0200 Message-Id: <20220426081748.049178955@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081747.286685339@linuxfoundation.org> References: <20220426081747.286685339@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Allen-KH Cheng [ Upstream commit 317c2045618cc1f8d38beb8c93a7bdb6ad8638c6 ] After system resumes, the registers of nor controller are initialized with default values. The nor controller will not function properly. To handle both issues above, we add mtk_nor_init() in mtk_nor_resume after pm_runtime_force_resume(). Fixes: 3bfd9103c7af ("spi: spi-mtk-nor: Add power management support") Signed-off-by: Allen-KH Cheng Reviewed-by: Rex-BC Chen Link: https://lore.kernel.org/r/20220412115743.22641-1-allen-kh.cheng@mediatek.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-mtk-nor.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-mtk-nor.c b/drivers/spi/spi-mtk-nor.c index 5c93730615f8..6d203477c04b 100644 --- a/drivers/spi/spi-mtk-nor.c +++ b/drivers/spi/spi-mtk-nor.c @@ -909,7 +909,17 @@ static int __maybe_unused mtk_nor_suspend(struct device *dev) static int __maybe_unused mtk_nor_resume(struct device *dev) { - return pm_runtime_force_resume(dev); + struct spi_controller *ctlr = dev_get_drvdata(dev); + struct mtk_nor *sp = spi_controller_get_devdata(ctlr); + int ret; + + ret = pm_runtime_force_resume(dev); + if (ret) + return ret; + + mtk_nor_init(sp); + + return 0; } static const struct dev_pm_ops mtk_nor_pm_ops = { -- 2.35.1