From patchwork Sun Apr 24 02:57:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhiyong.tao" X-Patchwork-Id: 12824743 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 67956C433EF for ; Sun, 24 Apr 2022 02:59:08 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=iMFpHGT3+CZh/f/VGoQYWNLMwk44y2NHbFIr+PaX8ss=; b=mUKbXkigTiKXAq E1NdPUFP2wOCVaXyfRRN8ukG6kp8agULnc07dNrxWn/PKe+mvo++zDXq/7lVWDwEk/kOy8ci2vI88 Jmy2vfxx31vD7pkAGJ2/wp4qicJUfJszrlnCetJOALAe1rybMRgiVNxxkmugJlXthGZowIkfS2yne 0tvzxTBUShcrLNnJvDzlGVE2lxXZmZh+qME2L0Ryx+yRcnfno2XgwYfXhNdLas4t8r0BE34fUqAVE MS74LxKpDLTegh+FV1KCDwDopdXlkieB9YR9ZZSNi/DTFA6IhYU7rPJc1j/5F5X5GiJrN7HIOfDeQ LaR5Jk7J3RpZOluVOysw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1niSRq-005c8E-TO; Sun, 24 Apr 2022 02:58:07 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1niSRm-005c75-Qv; Sun, 24 Apr 2022 02:58:04 +0000 X-UUID: 8b3c4325a1c5415ba90e9306308ad9db-20220423 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.4, REQID:69fcc72c-0a3f-4a50-b011-bdece5a1666b, OB:0, LO B:0,IP:0,URL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-META: VersionHash:faefae9, CLOUDID:452ab9f0-da02-41b4-b6df-58f4ccd36682, C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,File:nil,QS:0,BEC:nil X-UUID: 8b3c4325a1c5415ba90e9306308ad9db-20220423 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 328007817; Sat, 23 Apr 2022 19:57:58 -0700 Received: from mtkexhb02.mediatek.inc (172.21.101.103) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 23 Apr 2022 19:57:56 -0700 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkexhb02.mediatek.inc (172.21.101.103) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 24 Apr 2022 10:57:42 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sun, 24 Apr 2022 10:57:41 +0800 From: Zhiyong Tao To: , , , , , , , , CC: , , , , , , , , , , , , , Subject: [PATCH v3 1/1] pwrap: mediatek: fix FSM timeout issue Date: Sun, 24 Apr 2022 10:57:38 +0800 Message-ID: <20220424025738.32271-2-zhiyong.tao@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220424025738.32271-1-zhiyong.tao@mediatek.com> References: <20220424025738.32271-1-zhiyong.tao@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220423_195802_908971_5CF01CEF X-CRM114-Status: GOOD ( 11.73 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Zhiyong.Tao" Fix pwrap FSM timeout issue which leads the system crash on GFX VSRAM power on. Add a usleep delay to avoid busy read for the H/W status. For avoiding the system behavior(ex. disable interrupt in suspend/resume flow, schedule block task)cause if (time_after()) be turn first, we change it after sleep delay. Fixes: 1f022d84bd19 ("soc: mediatek: Add PMIC wrapper for MT8135 and MT8173 SoCs") Signed-off-by: Zhiyong.Tao Signed-off-by: Zhiyong.Tao --- drivers/soc/mediatek/mtk-pmic-wrap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c index 952bc554f443..ac7139a67e87 100644 --- a/drivers/soc/mediatek/mtk-pmic-wrap.c +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c @@ -12,6 +12,7 @@ #include #include #include +#include #define PWRAP_MT8135_BRIDGE_IORD_ARB_EN 0x4 #define PWRAP_MT8135_BRIDGE_WACS3_EN 0x10 @@ -1197,10 +1198,13 @@ static int pwrap_wait_for_state(struct pmic_wrapper *wrp, timeout = jiffies + usecs_to_jiffies(10000); do { - if (time_after(jiffies, timeout)) - return fp(wrp) ? 0 : -ETIMEDOUT; if (fp(wrp)) return 0; + + usleep_range(10, 11); + + if (time_after(jiffies, timeout)) + return fp(wrp) ? 0 : -ETIMEDOUT; } while (1); }