Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1324007rwd; Sun, 14 May 2023 17:42:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7SyKBPa2Cak/pjsj1WjAM48N5C6FOUK2tA97rjv4jkMukphGbQJCZPBsb1SLIX2OEv3QdA X-Received: by 2002:a05:6a20:394a:b0:101:9344:bf82 with SMTP id r10-20020a056a20394a00b001019344bf82mr25257162pzg.15.1684111344235; Sun, 14 May 2023 17:42:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684111344; cv=none; d=google.com; s=arc-20160816; b=JMhdjOcCkp2dPMEOuZzoj9iz1FoWegAQoJ/C4oDnH1UYjlgTIz1XgYVswZOGuteVtD LbrlMoRkmI1vjN4aouNWkOVBQxiZu3liAZjH3/aheJTdfSf2oAK/P5kYKLRVidegwFTL i2KF09H5csZtBQHAlzvpFRNpaRpYb5/OFZ+GhmeUqz1IJxP8Buz7DPQdMsP1JSVEmnv8 GKVQOfGCo9shLBn68qUPGP6D3vVFp3vmHZcTOWi6UnZpLZ8619V2LpzRTsWrjqf+40ll U2QDYJCxfcxzKvuXgZVB3yF4II9EcmDw4wlp6iiY4rJvvowPrtgxMDxVbVVq15s15K1C quEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:authenticated-by; bh=VjSYoOJJd02l/4Hb38/vfZUqfOzowgHyVBdp/4pbQ14=; b=MSkxmELgxis2yVwTZdHiFjBzQ//jNrcMqc+XFKODeT7/ig9n6Y12Y0u2nOYuWnGMPz HO7WcQKFW00EzWIWvs0p/9utLC8l5b9hw6AoqOYylnlYvZDEwXjc0EJl+/VFJHxbnZ/n gFt20RcoBEaL046Oc1V3Cf4bxPriK3+77oTJtOVUD5lfsoLtGh4vkbXyr6sGlghSrzkS xw2lEXuL4yoXeqseqg/20my6avuC0zS+HwKSEhIjZkLhlGUHUsQHISSMdebZo47JiiGl zKADareMv+DloXICfeufSfDOQroTWgXDqO756jXmRVXedpYkle0QFQ+BIrq9s+JVFwqF bLpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w1-20020a637b01000000b0050be7b93e73si14906932pgc.694.2023.05.14.17.42.10; Sun, 14 May 2023 17:42:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237522AbjEOAgz convert rfc822-to-8bit (ORCPT + 61 others); Sun, 14 May 2023 20:36:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbjEOAgz (ORCPT ); Sun, 14 May 2023 20:36:55 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDC7A11D; Sun, 14 May 2023 17:36:53 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 34F0aJroD025220, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.81/5.90) with ESMTPS id 34F0aJroD025220 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Mon, 15 May 2023 08:36:19 +0800 Received: from RTEXMBS01.realtek.com.tw (172.21.6.94) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.32; Mon, 15 May 2023 08:36:27 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXMBS01.realtek.com.tw (172.21.6.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Mon, 15 May 2023 08:36:27 +0800 Received: from RTEXMBS04.realtek.com.tw ([fe80::e138:e7f1:4709:ff4d]) by RTEXMBS04.realtek.com.tw ([fe80::e138:e7f1:4709:ff4d%5]) with mapi id 15.01.2375.007; Mon, 15 May 2023 08:36:27 +0800 From: Ping-Ke Shih To: Martin Blumenstingl , "linux-wireless@vger.kernel.org" CC: "linux-kernel@vger.kernel.org" , "tony0620emma@gmail.com" , "kvalo@kernel.org" , Larry Finger , Rudi Heitbaum Subject: RE: [PATCH wireless v1] wifi: rtw88: sdio: Always use two consecutive bytes for word operations Thread-Topic: [PATCH wireless v1] wifi: rtw88: sdio: Always use two consecutive bytes for word operations Thread-Index: AQHZhp8/d2Ix7H9Kp0Kc7VStDQy2qK9aesbQ Date: Mon, 15 May 2023 00:36:27 +0000 Message-ID: References: <20230514200345.502807-1-martin.blumenstingl@googlemail.com> In-Reply-To: <20230514200345.502807-1-martin.blumenstingl@googlemail.com> Accept-Language: en-US, zh-TW Content-Language: zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.21.69.188] x-kse-serverinfo: RTEXMBS01.realtek.com.tw, 9 x-kse-antispam-interceptor-info: fallback x-kse-antivirus-interceptor-info: fallback Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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-wireless@vger.kernel.org > -----Original Message----- > From: Martin Blumenstingl > Sent: Monday, May 15, 2023 4:04 AM > To: linux-wireless@vger.kernel.org > Cc: linux-kernel@vger.kernel.org; Ping-Ke Shih ; tony0620emma@gmail.com; > kvalo@kernel.org; Martin Blumenstingl ; Larry Finger > ; Rudi Heitbaum > Subject: [PATCH wireless v1] wifi: rtw88: sdio: Always use two consecutive bytes for word operations > > The Allwinner sunxi-mmc controller cannot handle word (16 bit) > transfers. So and sdio_{read,write}w fails with messages like the > following example using an RTL8822BS (but the same problems were also > observed with RTL8822CS and RTL8723DS chips): > rtw_8822bs mmc1:0001:1: Firmware version 27.2.0, H2C version 13 > sunxi-mmc 4021000.mmc: unaligned scatterlist: os f80 length 2 > sunxi-mmc 4021000.mmc: map DMA failed > rtw_8822bs mmc1:0001:1: sdio read16 failed (0x10230): -22 > > Use two consecutive single byte accesses for word operations instead. It > turns out that upon closer inspection this is also what the vendor > driver does, even though it does have support for sdio_{read,write}w. So > we can conclude that the rtw88 chips do support word access but only on > SDIO controllers that also support it. Since there's no way to detect if > the controller supports word access or not the rtw88 sdio driver > switches to the easiest approach: avoiding word access. > > Reported-by: Larry Finger > Closes: https://lore.kernel.org/linux-wireless/527585e5-9cdd-66ed-c3af-6da162f4b720@lwfinger.net/ "Closes:" seems not a regular tag. Use "Link: " instead. > Reported-by: Rudi Heitbaum Followed by a "Link: " if you have another one. > Fixes: 65371a3f14e7 ("wifi: rtw88: sdio: Add HCI implementation for SDIO based chipsets") > Signed-off-by: Martin Blumenstingl > --- > drivers/net/wireless/realtek/rtw88/sdio.c | 8 -------- > 1 file changed, 8 deletions(-) > > diff --git a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c > index af0459a79899..06fce7c3adda 100644 > --- a/drivers/net/wireless/realtek/rtw88/sdio.c > +++ b/drivers/net/wireless/realtek/rtw88/sdio.c > @@ -87,11 +87,6 @@ static void rtw_sdio_writew(struct rtw_dev *rtwdev, u16 val, u32 addr, > u8 buf[2]; > int i; > > - if (rtw_sdio_use_memcpy_io(rtwdev, addr, 2)) { > - sdio_writew(rtwsdio->sdio_func, val, addr, err_ret); > - return; > - } > - > *(__le16 *)buf = cpu_to_le16(val); > > for (i = 0; i < 2; i++) { > @@ -125,9 +120,6 @@ static u16 rtw_sdio_readw(struct rtw_dev *rtwdev, u32 addr, int *err_ret) > u8 buf[2]; > int i; > > - if (rtw_sdio_use_memcpy_io(rtwdev, addr, 2)) > - return sdio_readw(rtwsdio->sdio_func, addr, err_ret); > - > for (i = 0; i < 2; i++) { > buf[i] = sdio_readb(rtwsdio->sdio_func, addr + i, err_ret); > if (*err_ret) > -- > 2.40.1