Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3086244rwb; Mon, 15 Aug 2022 17:47:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR6VCIQQEbmipS83JnKE7dc2yBWnDBARKW6+Wm2idQlrhBANcAV8C8MYUDoSRuwCg4XvAwfe X-Received: by 2002:a17:902:e5c6:b0:16e:f3b6:ddb5 with SMTP id u6-20020a170902e5c600b0016ef3b6ddb5mr19318610plf.122.1660610857472; Mon, 15 Aug 2022 17:47:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610857; cv=none; d=google.com; s=arc-20160816; b=wLAICO5Fia5UIaa86TFLdAuWtKChMp+p9BT9JOtLKYOn8we2/gicKfWUNNDeqt1IGf 0gTa8jAm383GomaE1OWwQJSTn3Kbv2u9IJpVVBe6J0jtsFaJSYNhmPCx+d+drCIcPlm0 GGdI1YD5Oj8trOBydyWstBI7Y27h0Hp2CSBJ3+qf9GircCO/IDG7Vs7N9gGEofDY68l1 tjiD6QALAlUl1QTf0VUAIjzJz5FXrlacnmKhOE0X+2yz0jj+KtnDsdk6r/zffu+3tTsB t7m0sHIgN8YAKIDmhHaEBubto5LDHAUhDFvGEw4sX696AkDn7lB/YAkcbjKNsFF2/Vi7 miFg== 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=mqQplcE1w+gaTHFfbXxXX1U0kAPEXKWQySM0Wy9HKHU=; b=N8JE2rlGGJxb6d7RE2cmX91o/FWmfneg0J207Pjyo9jWmzAvij6NWokmv1iQgaykhU yc9OkJ/LflQ/jyb46xGdNXArwDUIRwwdFqzYExHUB/8SIlkprzMYtccewO7jRglLvzME rNtNw0q+0XpAqsO4uFZxh/KpIxd/viB2nfPR81kAIm7puPu1sUs7RpqJPc+4fI6Vck77 r5l8QiFRJrns6nAcwyGKLXJOGdvfFFjZobTalmX956XTVGs2uI43OGCzPNGg8w4VU8gu ql90rVDj2sfcv/JG1tnteYkYEwkyOpEbSgpqkze2h9I+KybwMezkqw0CWeEGBHcR5pjc jYAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=suiLlOi0; 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 bd33-20020a056a0027a100b00534b6674cb4si7064315pfb.301.2022.08.15.17.47.25; Mon, 15 Aug 2022 17:47:37 -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=suiLlOi0; 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 S1355191AbiHOXvi (ORCPT + 99 others); Mon, 15 Aug 2022 19:51:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355070AbiHOXrC (ORCPT ); Mon, 15 Aug 2022 19:47:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0422C2FFDE; Mon, 15 Aug 2022 13:15:18 -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 ams.source.kernel.org (Postfix) with ESMTPS id 641E6B810C5; Mon, 15 Aug 2022 20:15:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8D03C433C1; Mon, 15 Aug 2022 20:15:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594516; bh=ooOqqcVnm36iUHmdeC5rE0ouxQCEtgqtCwdpaPp9IBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=suiLlOi0gmv93+XDu+zrdovpQFsk0KHam3Jazbrj+Z4KMp+mVIdVkBZlig16tsfcr Xs841C6HczhWBYw2GivDJCZnqtvgxkeNZqJrf1Wz3w2Cy6qPJcP8fYE1CAOCjRexzO yY8M2yiXMDiNL66SP/aGBGYD2O18y1rUxVSiWJ14= 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.19 0471/1157] mt76: mt7921s: fix firmware download random fail Date: Mon, 15 Aug 2022 19:57:07 +0200 Message-Id: <20220815180458.446270706@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 12bab18c4171..71cbb9073485 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -582,13 +582,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) { @@ -599,6 +592,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