Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp821970lqh; Thu, 28 Mar 2024 19:01:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVTk7QXIuiGyPZlHaSG4aTBJlKLUI9aUBJ2p8rLEzFAqTtfqqDaE09COQaXRdQZAaiByNS3h6cvWJOa0oQmTPdsFpPhZo0VP3NgmElV/w== X-Google-Smtp-Source: AGHT+IFjWXOCr3LU+JOSnN8QJOGaVzpNEfch0WTRPcxENiXxEwuy05eyBVdknqmLmlpIdxTXK1Rh X-Received: by 2002:a17:90a:6545:b0:2a1:f455:c3d7 with SMTP id f5-20020a17090a654500b002a1f455c3d7mr1078527pjs.16.1711677676027; Thu, 28 Mar 2024 19:01:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711677676; cv=pass; d=google.com; s=arc-20160816; b=GvtwwdxjTXNhhkrtjqmfp4gd65jRzg3/tgGKPl4HwX0xit8qIsic7ZLAxGrBgpMlVq 2xwrVI2w02ECBi/SMf+VExdqHjhhMtzZkbdwiAE4tyZMPOLoqC8lcJzxqSv0hEoaMw1v +XTRD95MFX0GwWEkHYxw9RGJgSDiOMayQCNEfZMmPZAUmJO4QdB5k1Bp/gO6keXgoRYJ TDaYmW53iMuJ9osgT9iGLrK4t/NmJPVboCSVVOTUZoN2nqnQsA6oXbbpULm4VOurWtam 53sVwOXAN6qqu8Z0YwoZmLdiZQ5Lc100sXltKKp78158nGHSuHKMqzRmLTB5MBmIiwMa 92/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=nO0Q/qJB0qGOGr6mhmKVpt6M+HvgvN4nLk7G4+IJGC8=; fh=ww0D5vLQBB1uvGzpEYhbKWPKxDvHJfaqbwKWCOEiQeE=; b=Sq9Le3nC7Licrsbzs7uU7OgXLdPUigEri4Y/khrrqE5C/K4qOFl5zQPwkhcIy0+s+a 8zDc/3cNlUl5d41pmCArXO1YuWFwVWZkWnKMM7ydruYgjlDCs9EG10DWJhudQFm2GCre uaZ7pmJ//e6XtEpqjMUu1D8AieXYEHap4iUqICBnHKxhVSHpOMi3hPqdIDhnYvGPnZUt 5/ZO4wTXUphSwzSnZ+hOPJwrTdpwb6Ylr2efqg9ibHxvwFjjMA97CUmld6KkiU/4SUxK ECq1RMVfaUgAbksbZnmRDCmQ1RkcSVDKQqV45CrVpQLx6jlH4UKpl9JPbGioHhSyLxSz ncsw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-5514-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5514-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id o1-20020a635a01000000b005e46be657e9si2501672pgb.424.2024.03.28.19.01.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 19:01:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-5514-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-5514-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5514-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 7670BB241F8 for ; Fri, 29 Mar 2024 01:57:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 966513C482; Fri, 29 Mar 2024 01:54:21 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A295E3B797 for ; Fri, 29 Mar 2024 01:54:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711677261; cv=none; b=NMkoCHMwUJoEzo9XXXhq5/bwWivIW+WE0u0ijbkGIctaaYv1IP8Vv+bWgeZE1/KwOqsocGZDoA0lXlKpQmjqIVEBGTmVe8RhCMyeUGifu3KrtKl6/I9G/Tq7/QyADvY4nI7gR87zYccGsVMbV/hoAn7RIRHyWf26aPldet17Rss= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711677261; c=relaxed/simple; bh=W4Fi5BajZTas/9OFXUc1+YvQjd0szV3muYUvIVC0bqA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Y7M4L5mdkEOz4KJH/hAiKg4+6V+MjA9hPMhovOsbf/UNs3d8pWns0TYVsnu7uxAAdBR1PR3lt0H3oZf5y1WV5D60UMH7yHPKEODOZqZyVtR7bcmWuPXe3DhZcOL0BwEqPF09TPdSiIxmN777WX9kNSPl+F/+7fMrXtFD1TjmfQ0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 42T1sG1s93183197, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.95/5.92) with ESMTPS id 42T1sG1s93183197 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 29 Mar 2024 09:54:16 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 29 Mar 2024 09:54:16 +0800 Received: from [127.0.1.1] (172.21.69.94) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 29 Mar 2024 09:54:16 +0800 From: Ping-Ke Shih To: CC: , Subject: [PATCH 1/4] wifi: rtw89: download firmware with five times retry Date: Fri, 29 Mar 2024 09:52:48 +0800 Message-ID: <20240329015251.22762-2-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240329015251.22762-1-pkshih@realtek.com> References: <20240329015251.22762-1-pkshih@realtek.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: RTEXMBS02.realtek.com.tw (172.21.6.95) To RTEXMBS04.realtek.com.tw (172.21.6.97) From: Chia-Yuan Li After firmware boots, it reads keys info from efuse and checks secure checksum, but suddenly failed to access efuse resulting in probe failure, and driver throws messages: rtw89_8852be 0000:03:00.0: fw security fail rtw89_8852be 0000:03:00.0: download firmware fail rtw89_8852be 0000:03:00.0: [ERR]fwdl 0x1E0 = 0xe2 rtw89_8852be 0000:03:00.0: [ERR]fwdl 0x83F0 = 0x210090 Retry five times to resolve rare abnormal hardware state. Signed-off-by: Chia-Yuan Li Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/fw.c | 27 +++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c index f27486d35cbc..e3a07b3d2c72 100644 --- a/drivers/net/wireless/realtek/rtw89/fw.c +++ b/drivers/net/wireless/realtek/rtw89/fw.c @@ -1349,13 +1349,12 @@ static void rtw89_fw_prog_cnt_dump(struct rtw89_dev *rtwdev) static void rtw89_fw_dl_fail_dump(struct rtw89_dev *rtwdev) { u32 val32; - u16 val16; val32 = rtw89_read32(rtwdev, R_AX_WCPU_FW_CTRL); rtw89_err(rtwdev, "[ERR]fwdl 0x1E0 = 0x%x\n", val32); - val16 = rtw89_read16(rtwdev, R_AX_BOOT_DBG + 2); - rtw89_err(rtwdev, "[ERR]fwdl 0x83F2 = 0x%x\n", val16); + val32 = rtw89_read32(rtwdev, R_AX_BOOT_DBG); + rtw89_err(rtwdev, "[ERR]fwdl 0x83F0 = 0x%x\n", val32); rtw89_fw_prog_cnt_dump(rtwdev); } @@ -1394,8 +1393,9 @@ static int rtw89_fw_download_suit(struct rtw89_dev *rtwdev, return 0; } -int rtw89_fw_download(struct rtw89_dev *rtwdev, enum rtw89_fw_type type, - bool include_bb) +static +int __rtw89_fw_download(struct rtw89_dev *rtwdev, enum rtw89_fw_type type, + bool include_bb) { const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def; struct rtw89_fw_info *fw_info = &rtwdev->fw; @@ -1433,7 +1433,7 @@ int rtw89_fw_download(struct rtw89_dev *rtwdev, enum rtw89_fw_type type, ret = rtw89_fw_check_rdy(rtwdev, RTW89_FWDL_CHECK_FREERTOS_DONE); if (ret) { rtw89_warn(rtwdev, "download firmware fail\n"); - return ret; + goto fwdl_err; } return ret; @@ -1443,6 +1443,21 @@ int rtw89_fw_download(struct rtw89_dev *rtwdev, enum rtw89_fw_type type, return ret; } +int rtw89_fw_download(struct rtw89_dev *rtwdev, enum rtw89_fw_type type, + bool include_bb) +{ + int retry; + int ret; + + for (retry = 0; retry < 5; retry++) { + ret = __rtw89_fw_download(rtwdev, type, include_bb); + if (!ret) + return 0; + } + + return ret; +} + int rtw89_wait_firmware_completion(struct rtw89_dev *rtwdev) { struct rtw89_fw_info *fw = &rtwdev->fw; -- 2.25.1