Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2930205rwb; Mon, 15 Aug 2022 14:16:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR6JwV+SVjDFf6wrLN9/a8pfmmF+CcjSRBe5EaCQuW6hRzTW/2Lu5ErpDFM01dzr97Qi4z5C X-Received: by 2002:aa7:d292:0:b0:43d:7923:66cd with SMTP id w18-20020aa7d292000000b0043d792366cdmr15327415edq.403.1660598162613; Mon, 15 Aug 2022 14:16:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660598162; cv=none; d=google.com; s=arc-20160816; b=ZXWuVf8JqB3Y5/RyLGEbkHzFp0DuiLOnuqfytxTbzQdeWa0akZU9dv5MlxMsmAfdYz k52N1/NvCC7xKrHTvPw8xHYTBfjIOEuzcjPGKZvqPjH0kEsLZzsE5PLp/thYdMzu2sl2 4aD2ZWb6hiD91HwRydM3Ch4+4FSTsCotNBlsRUKmrXsW6cWT+nWdZuC+FNu/6esx/mR4 19RdX6QREx+Gyzrg0E0TBqqRETo81DLDYshsAV7MmHngj8NkSS9TQv48goeWaNIC1WXC Y8AUyiPmZ6QqDZlPV34/D3hDZHpTbsmGZ1FGyuf3jI0Ds/fJWUfoC3w/aOWAdR1fXyu4 qirQ== 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=RaMhLowwPNDuOOPko9oYaeYHNdDz37NO1G8g7FdeD54=; b=S18PsUZ4t5UHVK8rvOTxplaMuEWwjnc7NsjUsVXLOWoveoPD+vryOZ5vk05hbG+cvr IdLTU9EP9D45MWbIdvueZUfHXtlnszYf7kRtjqkELszz7WQ/XCd9rI2yDzXg17Kp6FzY Vbf5LMNdGv4vDqU6Ylyhm/fpvqbSnTIGLvMpWNhmwYlIlGYYyynm9PSsNKfdUmmtijln s0h7pkdT4gflgwCOUGFh6d0Os+uMrf979O9TrjjNV4mEldeH876+MgArixphqTmcpahI WkSqXrqsMJF6jMl8+OEbGIEm5qrloNASlgeZ+99Upi9e93sR9ZQVbuYts04GqzzpUiX8 FqCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HDePn8L7; 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 h4-20020aa7c944000000b0043d64c59b10si7937370edt.94.2022.08.15.14.15.34; Mon, 15 Aug 2022 14:16:02 -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=HDePn8L7; 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 S240566AbiHOVNb (ORCPT + 99 others); Mon, 15 Aug 2022 17:13:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347928AbiHOVHq (ORCPT ); Mon, 15 Aug 2022 17:07:46 -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 868322B185; Mon, 15 Aug 2022 12:16:46 -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 25FE360EF0; Mon, 15 Aug 2022 19:16:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CD65C433D6; Mon, 15 Aug 2022 19:16:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591005; bh=fQvQWAEajSJ2fek1XKvOZ9Xp2q9da3v0Jkxxl0TpCXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HDePn8L7hGWqNFR45EmmLcDFKQl4TR74nnn/nWqzKW3cccco0Stwrg4SjHIIHd38e avy49tC11yW+l1dtQNCY47YJKbK8erIjqyV/8Ty9ljvwDUQ8/e0uxha9b/C2qP8twX 6EjILPXHLKGM4ZsnQYmV8tuRVI1NIYTBKvOybFvk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YN Chen , Deren Wu , Felix Fietkau , Sasha Levin Subject: [PATCH 5.18 0442/1095] mt76: mt7921s: fix firmware download random fail Date: Mon, 15 Aug 2022 19:57:21 +0200 Message-Id: <20220815180447.939220294@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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,T_SCC_BODY_TEXT_LINE 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: YN Chen [ Upstream commit a55a0c701c129f8e448f0ec1eb811dba728ace64 ] To avoid racing problems in chip, mt7921s should reacquire drv-own after firmware semaphore is released. Fixes: 78b217580c509 ("mt76: mt7921s: fix bus hang with wrong privilege") Signed-off-by: YN Chen Signed-off-by: Deren Wu Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c index da2be050ed7c..2a609b25561c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -538,13 +538,6 @@ static int mt7921_load_patch(struct mt7921_dev *dev) if (ret) dev_err(dev->mt76.dev, "Failed to start patch\n"); - if (mt76_is_sdio(&dev->mt76)) { - /* activate again */ - ret = __mt7921_mcu_fw_pmctrl(dev); - if (!ret) - ret = __mt7921_mcu_drv_pmctrl(dev); - } - out: sem = mt76_connac_mcu_patch_sem_ctrl(&dev->mt76, false); switch (sem) { @@ -555,6 +548,14 @@ static int mt7921_load_patch(struct mt7921_dev *dev) dev_err(dev->mt76.dev, "Failed to release patch semaphore\n"); break; } + + if (!ret && mt76_is_sdio(&dev->mt76)) { + /* activate again */ + ret = __mt7921_mcu_fw_pmctrl(dev); + if (!ret) + ret = __mt7921_mcu_drv_pmctrl(dev); + } + release_firmware(fw); return ret; -- 2.35.1