Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp197839rbe; Wed, 28 Feb 2024 17:39:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUTD4+L3LUrr2py+tAgpTB5wbaenZwK0hGhLnrPVfi8dfDWYyHOgY1fOkmug6CHHtTNMThMAGs/z5fLz8JdI1ESJwD2lvHaJGb6K9mbIg== X-Google-Smtp-Source: AGHT+IHt/29/UtA0/V0792MjAeOsx7mk8Vql4c+N8yQK5MbAlj+Tszoj12tP3SUfCWBuGCRWHX8M X-Received: by 2002:a05:6830:1494:b0:6e4:94d9:6aa3 with SMTP id s20-20020a056830149400b006e494d96aa3mr607352otq.28.1709170742701; Wed, 28 Feb 2024 17:39:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709170742; cv=pass; d=google.com; s=arc-20160816; b=JdynQyB8pAA3I2hUwYsMghvRoKqIchWOCVgMCYFlluelZS+YBEga+1tWaQDuwfwKzM jIoGcOzgl8QBbwv1T+ZWoD8FajwMEgahrvYEV0POcsi3PaFRubAg3ln9zvqP4UtFe7x8 Ptm9ijlsPvtUUQLanX2Sd92V+oPNl5Ye3XgYmQs447HTvBNdaCz2lRU/lwa4Yf6AqXjI 8zJd7OE6b1NBDeE1M1tBDxwgVwuQErGQVIJuVZysu9m/OJIrScB6qLpikcUQTtmdE9Ph VYkGCZZUAx6XFlqW2U3rDIeUFNWI97x8sv8kJnScSZTJErqPjuyjqq2Nigd30I8pnhnu asKw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:content-language:accept-language :in-reply-to:references:message-id:date:thread-index:thread-topic :subject:cc:to:from; bh=uhc2cQC3a0tGU3OPEiWHfd1L/kSqIjldm/7c0GhPfX0=; fh=nKuRLuWxeHC03GWAlBO/eM4FbcBDXAziNfed4NyDcsQ=; b=PoxVEP/gRmcKu5N3yoQR4/Hdive+ITXuxTxWpo41C2OzaUhMpMz+qsz5/eE6P0FwHl 3U/aBT//iZ9iOJiwEBPp7hGbUVtvgT5XBuxpgEWV4+ja8j9Wrjsw+n1FvX4fNNQf7MRW tJr0nq/EpPaH9Y0snSoZg58QEjxeM72EzV4u0rqELy2OsHGPq8Xl4CCnd1UcmIFfgMV7 DdcwqIznE9CxOq5Xn0E42xkdvb/M6ft2ynb3P3EBW7UbfDZL8BR/+Fi0jqPxSaV2Z3BL Wl10zX44AubS+1l6rvrMc5b/WdJxVFSAZ/loP1Gl38EZxSohGOv4Y+U9Ts21cmOO2vDf USLQ==; 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-4219-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4219-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id b62-20020a633441000000b005df469b4f7asi296074pga.489.2024.02.28.17.39.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 17:39:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4219-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-4219-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4219-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 56D33B22279 for ; Thu, 29 Feb 2024 01:38:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B114D36135; Thu, 29 Feb 2024 01:37:28 +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 49684339A0 for ; Thu, 29 Feb 2024 01:37:24 +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=1709170648; cv=none; b=ECWh0mMAYSxWYaim2/mpxlbYRih4Xb9sNasId8RIy1P5QUNAXHBdBgYhmENVJsSztOGKYsQmaQELugDH0KpuLVwrsGnGetNlp9Cnshd8q3iO30qfgTi7KVk6OpsJ041sBzW2Z69I0vmK5cE7RVVS1ZhS/vB34c0CDSX/9AdDSY0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709170648; c=relaxed/simple; bh=skPpaEuLRIZ6eirQIPaCaL+NCBFs2dA2ubPpPVKK8cg=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=DAIvVznd+yjETNXNHy56SXCJtgpTC71fQQ1Fh/l/BhuU/Rlw+gW/o407pl0MFtlvbL6b4kke/bbQu2cQyN5qZFrzWGPE3iTKt7fFiATJNyStJ4n0h2SwJHsXtooFlg+FfDQxjENYevLJhVVoGI4yj6m+mj3DedII0PuCQnx0jIU= 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 41T1b9llD988269, 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 41T1b9llD988269 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 29 Feb 2024 09:37:09 +0800 Received: from RTEXMBS06.realtek.com.tw (172.21.6.99) 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.17; Thu, 29 Feb 2024 09:37:08 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXMBS06.realtek.com.tw (172.21.6.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 29 Feb 2024 09:37:08 +0800 Received: from RTEXMBS04.realtek.com.tw ([fe80::c9b7:82a9:7e98:fa7f]) by RTEXMBS04.realtek.com.tw ([fe80::c9b7:82a9:7e98:fa7f%7]) with mapi id 15.01.2507.035; Thu, 29 Feb 2024 09:37:08 +0800 From: Ping-Ke Shih To: Sascha Hauer , Bitterblue Smith CC: "linux-wireless@vger.kernel.org" , "Sean Mollet" Subject: RE: [PATCH 1/4] wifi: rtw88: 8821cu: Fix firmware upload fail Thread-Topic: [PATCH 1/4] wifi: rtw88: 8821cu: Fix firmware upload fail Thread-Index: AQHaaXcR3HkprUxyPEepnjoj4RB95rEdn6yAgAA7GoCAARQJgIABmkjQ Date: Thu, 29 Feb 2024 01:37:08 +0000 Message-ID: References: <731ea688-04ef-4f02-9d01-3e9026981057@gmail.com> In-Reply-To: Accept-Language: en-US, zh-TW Content-Language: zh-TW Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 > -----Original Message----- > From: Sascha Hauer > Sent: Wednesday, February 28, 2024 4:56 PM > To: Bitterblue Smith > Cc: linux-wireless@vger.kernel.org; Ping-Ke Shih ; Se= an Mollet > Subject: Re: [PATCH 1/4] wifi: rtw88: 8821cu: Fix firmware upload fail >=20 > On Tue, Feb 27, 2024 at 06:27:51PM +0200, Bitterblue Smith wrote: > > Adding Sean Mollet because I forgot earlier. > > > > On 27/02/2024 14:56, Sascha Hauer wrote: > > > On Tue, Feb 27, 2024 at 02:18:20PM +0200, Bitterblue Smith wrote: > > >> + if (addr < 0xFE00) { > > >> + if (addr <=3D 0xff) > > >> + current_reg_sec =3D REG_ON_SEC; > > >> + else if (0x1000 <=3D addr && addr <=3D 0x10ff) > > >> + current_reg_sec =3D REG_ON_SEC; > > >> + else > > >> + current_reg_sec =3D REG_OFF_SEC; > > >> + } else { > > >> + current_reg_sec =3D REG_LOCAL_SEC; > > >> + } > > >> + > > >> + if (current_reg_sec !=3D REG_ON_SEC) > > >> + return; > > > > > > Is there something we want to do with current_reg_sec =3D=3D REG_LOCA= L_SEC > > > or current_reg_sec =3D=3D REG_OFF_SEC later? If not the above could b= e > > > rewritten as: > > > > > > if (addr > 0xff && addr < 0x1000) > > > return; > > > if (addr > 0x10ff) > > > return; > > > > > > ... > > > > Dunno, I just copied the code from the other drivers: > > > > > https://github.com/morrownr/8821cu-20210916/blob/5b39398e2de146edeb767164= 20f3288f508bea61/os_dep/linux > /usb_ops_linux.c#L171 >=20 > Ok, nothing is done with current_reg_sec here as well, so I suggest > rewriting the check like I suggested. I also prefer rewriting the code, but we can add comments to describe there are three sections:=20 1. on (0x00~0xFF;0x1000~0x10FF): this section is always powered on 2. off (< 0xFE00; but not on section): this section could be powered off 3. local (>=3D 0xFE00): usb specific registers section=20 Since only on-section needs special deal, maybe positively listing register ranges would be clear, like bool reg_on_sec =3D false; if ((addr >=3D 0x00 && addr <=3D 0xFF) || (addr >=3D 0x1000 && addr <=3D 0x10FF)) reg_on_sec =3D true; if (!reg_on_sec) return; Ping-Ke