Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1946963rwd; Mon, 15 May 2023 05:27:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7LnaMkqBI6mmeyglCB/mELWYJ4VzVPK6zXTJdyqWcjnMCT504uE0noLvIyC9O9O7SHzho4 X-Received: by 2002:a17:902:f552:b0:1ac:a058:555e with SMTP id h18-20020a170902f55200b001aca058555emr29870547plf.8.1684153622323; Mon, 15 May 2023 05:27:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684153622; cv=none; d=google.com; s=arc-20160816; b=Clg19oergV5fSKn0a0XHYe6qqctFSS3VoD+GowBtdV26TM0spz2M9/y+LSwArYbbqn kCufgls+p5ZWhkEl6/bg8V1XS+fhoFMXlbmW+kZbPu22zEDwqKtdIhARa+peltiJ1aVa uR6I7XZP1mn5CeU/HJtFk9M4a8AQF+ZGNe5Fhs5fZw87FoLGdtyIANFlDYwU+LHo+BAx +tn61NoyH4GbmiiQB6bqK674lSeihfbvW8U/tl9xyAjnvEABrcLJ/yCPilfhDzQn+2So nln1lp30vYzUITKjpI5vjg0f6fi62sfSYFFR3qize4KGGnaFLk/k5CxOXgAmeQQMG8LB KFeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=sPBAfbPStH09i45L5DnPnuQOFxW4JGqFBQ2GbD9peU0=; b=x/YsZ7C+CzvG8TDgxC920o35ZVZxcqrrJbBvgvlhZNZYT5uUprlaXDIqZoQoSJ9A69 N8JBKCuUOHT/TX0UVXYthnhuAzEIO7CmzBoh83qTWNohdiPbBUdKUPUl47oRmYBM0WTW ZEYRaJYL/d12iYIfLu2ZoShP9AM7ULug3z3WcqRQzl3ycty5Wwldy9mI18NyyZo60RH5 o4ekdxpiNeRPpxZSMpm5SUACaAO2lAHRAnMW1s3OSW1autDIFRxCgnwiwBWcKCw7K4Wi bZbitSN8bikz62b9K39m9IuXv6J3vdAADrZsVX3gVLJHJNmGptJLIJUpiN+FQCz/wy/F p5Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=YH+Shd9j; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f3-20020a170902e98300b001a6eb86e0bcsi15771534plb.294.2023.05.15.05.26.52; Mon, 15 May 2023 05:27:02 -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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=YH+Shd9j; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241685AbjEOMS5 (ORCPT + 62 others); Mon, 15 May 2023 08:18:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241096AbjEOMS4 (ORCPT ); Mon, 15 May 2023 08:18:56 -0400 Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DE861BC; Mon, 15 May 2023 05:18:55 -0700 (PDT) Received: by mail-qv1-xf33.google.com with SMTP id 6a1803df08f44-61b6101a166so59491496d6.0; Mon, 15 May 2023 05:18:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684153134; x=1686745134; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=sPBAfbPStH09i45L5DnPnuQOFxW4JGqFBQ2GbD9peU0=; b=YH+Shd9jg7YumKA78gdtc+aSlzrP79SxdxGoi2LxreTrbGsx/a/9bApYKhuXR+yf7f XiQ/Fy9cZrz0ATTUwALDiF/5J1lVM/XHRpp2SiENfyuOOL3Ha18qWpUYxAmtgr/Q7sEe tPhuIcKq9O8tR7SWlIH6Pul8dhc/jTz92trOtsxYKRhP2JnY19qlWuy1jBCeyX7rqI8x PG9JpXN47/jIdsDf+pPHVeFzwDW1lYFZh/dYSVr/HPlBx7lVR0PUEwPIgTxem1sEXy9a hlxOa2ESZMoOtOP5//8pWG3pqTlKm8h6kCx8rq30evHaqLnZ1LQqfG2grBAEo3kygvxy veNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684153134; x=1686745134; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sPBAfbPStH09i45L5DnPnuQOFxW4JGqFBQ2GbD9peU0=; b=DWF6PFH48kRpeXovUJrmj71rfb7C5O7fRR1lFhBP2QeFzykdOEBG6ZvoEYAzLbej7x Nk3/JjD27njoHs9aOduP1U2oIHVuqffOhn7bZ6BA5UNH+LdOPV7bDtlKjFOkTw2O2ORU SgBtP3IqZ8gmPfd4z/j2sP+A/NwbeoZ68ph2XVijKYPKZMyz+1mn+VLw69ShCO28Giak 0aPj0paFyU7WSy+uQN55b4Zb09frIyjjjvaeWF0cRm97IWtjWbN8Q1TO5NIrCL0w6LmU IwIFPA6FyH0cu/0i5VprFuaDAQxQec/sBcItwj7y90CeCpnvAa1Ju4AtPIISpHdiDmr3 YcuA== X-Gm-Message-State: AC+VfDxDOSWT81sGIstipLliG+rBk2GtJrliwUKBu+k4EV46M9LjDy8j q6tQHSAG+xG33tLD4ULBqRH/YfvcHUBm2fFQLAU= X-Received: by 2002:ad4:596d:0:b0:623:690c:3cd7 with SMTP id eq13-20020ad4596d000000b00623690c3cd7mr2116171qvb.47.1684153134129; Mon, 15 May 2023 05:18:54 -0700 (PDT) MIME-Version: 1.0 References: <20230514200345.502807-1-martin.blumenstingl@googlemail.com> In-Reply-To: <20230514200345.502807-1-martin.blumenstingl@googlemail.com> From: Julian Calaby Date: Mon, 15 May 2023 22:18:41 +1000 Message-ID: Subject: Re: [PATCH wireless v1] wifi: rtw88: sdio: Always use two consecutive bytes for word operations To: Martin Blumenstingl Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, pkshih@realtek.com, tony0620emma@gmail.com, kvalo@kernel.org, Larry Finger , Rudi Heitbaum , linux-sunxi@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Hi Martin, On Mon, May 15, 2023 at 6:12=E2=80=AFAM Martin Blumenstingl wrote: > > 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-6d= a162f4b720@lwfinger.net/ > Reported-by: Rudi Heitbaum > Fixes: 65371a3f14e7 ("wifi: rtw88: sdio: Add HCI implementation for SDIO = based chipsets") > Signed-off-by: Martin Blumenstingl The linux-sunxi folks might have comments, so I've added them to CC. > --- > 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/wire= less/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, u1= 6 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 =3D cpu_to_le16(val); > > for (i =3D 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 =3D 0; i < 2; i++) { > buf[i] =3D sdio_readb(rtwsdio->sdio_func, addr + i, err_r= et); > if (*err_ret) > -- > 2.40.1 > Thanks, -- Julian Calaby Email: julian.calaby@gmail.com Profile: http://www.google.com/profiles/julian.calaby/