Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="eCoWDSs5" Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 804521A8 for ; Thu, 23 Nov 2023 05:11:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=gXgV0F4FOx7+c/DG+6FQ4iMI7j7o6yeU8FnZx9OdG7E=; b=eCoWDSs5o1umKRJnuo/jt0xXli xZ+QlzbJE3o9Yl+nbVStWX0TcNb0yB0Qtq+dOFfsi4n0vHYvZ2WyOYu8rwjivfIdWJKY7qkqo4f1q bny9W1HELp7UaSA8SspezpI39v6FPOkWqPigUJZchJvW+lo6sSAJ4sdZM1yEkdeehQfqFWf64REKJ Zq0lq1ftLg9bpUuS4/mDyrSLt+CCG2xiPARj9vMlKkk79DBqyS3T2UIkfNneHEddmkxKieDJj9BIr UVJl+TGXRZzUt7F6mZSYiKzxJ674PpHAgue6t0+dcVIDz0ts+QYBfHaYOnQhkEirYc2ncSsoLPgi1 H6cvSo0w==; Received: from [177.34.168.16] (helo=morissey..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1r69Uc-006Nqb-Mq; Thu, 23 Nov 2023 14:11:43 +0100 From: =?UTF-8?q?Ma=C3=ADra=20Canal?= To: stable@vger.kernel.org Cc: =?UTF-8?q?Ma=C3=ADra=20Canal?= , Florian Fainelli , Stefan Wahren , Ulf Hansson Subject: [PATCH 6.1.y] soc: bcm: bcm2835-power: check if the ASB register is equal to enable Date: Thu, 23 Nov 2023 10:11:15 -0300 Message-ID: <20231123131114.562016-2-mcanal@igalia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <2023112258-embezzle-unspoiled-01c4@gregkh> References: <2023112258-embezzle-unspoiled-01c4@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The commit c494a447c14e ("soc: bcm: bcm2835-power: Refactor ASB control") refactored the ASB control by using a general function to handle both the enable and disable. But this patch introduced a subtle regression: we need to check if !!(readl(base + reg) & ASB_ACK) == enable, not just check if (readl(base + reg) & ASB_ACK) == true. Currently, this is causing an invalid register state in V3D when unloading and loading the driver, because `bcm2835_asb_disable()` will return -ETIMEDOUT and `bcm2835_asb_power_off()` will fail to disable the ASB slave for V3D. Fixes: c494a447c14e ("soc: bcm: bcm2835-power: Refactor ASB control") Signed-off-by: MaĆ­ra Canal Reviewed-by: Florian Fainelli Reviewed-by: Stefan Wahren Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20231024101251.6357-2-mcanal@igalia.com Signed-off-by: Ulf Hansson (cherry picked from commit 2e75396f1df61e1f1d26d0d703fc7292c4ae4371) --- drivers/soc/bcm/bcm2835-power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/bcm/bcm2835-power.c b/drivers/soc/bcm/bcm2835-power.c index 5bcd047768b6..cbcd1298ef5b 100644 --- a/drivers/soc/bcm/bcm2835-power.c +++ b/drivers/soc/bcm/bcm2835-power.c @@ -175,7 +175,7 @@ static int bcm2835_asb_control(struct bcm2835_power *power, u32 reg, bool enable } writel(PM_PASSWORD | val, base + reg); - while (readl(base + reg) & ASB_ACK) { + while (!!(readl(base + reg) & ASB_ACK) == enable) { cpu_relax(); if (ktime_get_ns() - start >= 1000) return -ETIMEDOUT; -- 2.41.0