From: Ping-Ke Shih <pkshih@realtek.com>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
Yan-Hsuan Chuang <tony0620emma@gmail.com>,
Kalle Valo <kvalo@kernel.org>,
Ulf Hansson <ulf.hansson@linaro.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
Chris Morgan <macroalpha82@gmail.com>,
"Nitin Gupta" <nitin.gupta981@gmail.com>,
Neo Jou <neojou@gmail.com>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Larry Finger <Larry.Finger@lwfinger.net>
Subject: RE: [PATCH v3 2/9] wifi: rtw88: sdio: Add HCI implementation for SDIO based chipsets
Date: Mon, 27 Mar 2023 09:11:56 +0000 [thread overview]
Message-ID: <33e7ca4c7ba947d68d451e919837f6b7@realtek.com> (raw)
In-Reply-To: <CAFBinCAxuEyNkUxsqJ9wVxXupErcp33JCFsJ2hDupWj9MRMYGA@mail.gmail.com>
> -----Original Message-----
> From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Sent: Friday, March 24, 2023 3:04 AM
> To: Ping-Ke Shih <pkshih@realtek.com>
> Cc: linux-wireless@vger.kernel.org; Yan-Hsuan Chuang <tony0620emma@gmail.com>; Kalle Valo
> <kvalo@kernel.org>; Ulf Hansson <ulf.hansson@linaro.org>; linux-kernel@vger.kernel.org;
> netdev@vger.kernel.org; linux-mmc@vger.kernel.org; Chris Morgan <macroalpha82@gmail.com>; Nitin Gupta
> <nitin.gupta981@gmail.com>; Neo Jou <neojou@gmail.com>; Jernej Skrabec <jernej.skrabec@gmail.com>; Larry
> Finger <Larry.Finger@lwfinger.net>
> Subject: Re: [PATCH v3 2/9] wifi: rtw88: sdio: Add HCI implementation for SDIO based chipsets
>
> Hello Ping-Ke,
>
> On Thu, Mar 23, 2023 at 12:16 PM Martin Blumenstingl
> <martin.blumenstingl@googlemail.com> wrote:
> [...]
> > > > + if (direct) {
> > > > + addr = rtw_sdio_to_bus_offset(rtwdev, addr);
> > > > + val = rtw_sdio_readl(rtwdev, addr, &ret);
> > > > + } else if (addr & 3) {
> > >
> > > else if (IS_ALIGNED(addr, 4) {
> > I'll add these IS_ALIGNED in v4
> > Also I found an issue with RTW_WCPU_11N devices where indirect read
> > works differently (those can't use
> > REG_SDIO_INDIRECT_REG_CFG/REG_SDIO_INDIRECT_REG_DATA but need to go
> > through the normal path with WLAN_IOREG_OFFSET instead). I'll also
> > include that fix in v4
> I have a question about the "indirect" handling.
> Let me start with what I know:
> - REG_SDIO_INDIRECT_REG_CFG and REG_SDIO_INDIRECT_REG_DATA are only
> present on RTW_WCPU_11AC based chips (older RTW_WCPU_11N chips don't
> have these registers)
> - the name of REG_SDIO_INDIRECT_REG_CFG[20] is not known but we're
> polling that bit to check if REG_SDIO_INDIRECT_REG_DATA is ready to be
> read or has data from REG_SDIO_INDIRECT_REG_DATA has been written
> - REG_SDIO_INDIRECT_REG_CFG[19] configures a read operation
> - REG_SDIO_INDIRECT_REG_CFG[18] configures a write operation
> - REG_SDIO_INDIRECT_REG_CFG[17] indicates that a DWORD (32-bit) are
> written to REG_SDIO_INDIRECT_REG_DATA (+ the following 3), this bit
> seems irrelevant for read mode
> - REG_SDIO_INDIRECT_REG_CFG[16] indicates that a DWORD (16-bit) are
> written to REG_SDIO_INDIRECT_REG_DATA (+ the following 3), this bit
> seems irrelevant for read mode
> - RTW_WCPU_11N chips are simply using "addr | WLAN_IOREG_OFFSET" for
> accesses that would usually be "indirect" reads/writes on
> RTW_WCPU_11AC chips
>
> While fixing the issue for the RTW_WCPU_11N chips I discovered that
> the "old" approach for indirect register access (without
> REG_SDIO_INDIRECT_REG_CFG and REG_SDIO_INDIRECT_REG_DATA) also works
> on RTW_WCPU_11AC chips.
> (I'm calling it the "old" approach because it's what the RTL8723DS an
> RTL8723BS vendor drivers use)
> In fact, this series is using the "old" approach for writes, but the
> new (REG_SDIO_INDIRECT_REG_CFG and REG_SDIO_INDIRECT_REG_DATA based)
> approach for reads.
> Naturally I'm curious as to why two different approaches achieve the
> same goal. Using the "old" approach (addr | WLAN_IOREG_OFFSET) means a
> lot of code could be deleted/simplified.
>
> Now my question:
> Do you have any explanation (either from internal documentation or
> from the hardware/firmware teams) if and when the
> REG_SDIO_INDIRECT_REG_CFG and REG_SDIO_INDIRECT_REG_DATA registers
> should be used on RTW_WCPU_11AC chips?
>
Using REG_SDIO_INDIRECT_REG_CFG and REG_SDIO_INDIRECT_REG_DATA if you are
using SDIO 3.0; otherwise, it could causes IO abnormal. Oppositely, using
"old" approach (addr | WLAN_IOREG_OFFSET) for SDIO 2.0.
Ping-Ke
next prev parent reply other threads:[~2023-03-27 9:12 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-20 21:34 [PATCH v3 0/9] rtw88: Add SDIO support Martin Blumenstingl
2023-03-20 21:35 ` [PATCH v3 1/9] wifi: rtw88: Clear RTW_FLAG_POWERON early in rtw_mac_power_switch() Martin Blumenstingl
2023-03-23 2:02 ` Ping-Ke Shih
2023-03-20 21:35 ` [PATCH v3 2/9] wifi: rtw88: sdio: Add HCI implementation for SDIO based chipsets Martin Blumenstingl
2023-03-23 2:23 ` Ping-Ke Shih
2023-03-23 11:16 ` Martin Blumenstingl
2023-03-23 19:03 ` Martin Blumenstingl
2023-03-27 9:11 ` Ping-Ke Shih [this message]
2023-03-20 21:35 ` [PATCH v3 3/9] wifi: rtw88: mac: Support SDIO specific bits in the power on sequence Martin Blumenstingl
2023-03-23 2:27 ` Ping-Ke Shih
2023-03-20 21:35 ` [PATCH v3 4/9] wifi: rtw88: main: Add the {cpwm,rpwm}_addr for SDIO based chipsets Martin Blumenstingl
2023-03-23 2:28 ` Ping-Ke Shih
2023-03-20 21:35 ` [PATCH v3 5/9] wifi: rtw88: main: Reserve 8 bytes of extra TX headroom for SDIO cards Martin Blumenstingl
2023-03-23 2:28 ` Ping-Ke Shih
2023-03-20 21:35 ` [PATCH v3 6/9] mmc: sdio: add Realtek SDIO vendor ID and various wifi device IDs Martin Blumenstingl
2023-03-23 2:29 ` Ping-Ke Shih
2023-03-26 14:02 ` Pali Rohár
2023-03-20 21:35 ` [PATCH v3 7/9] wifi: rtw88: Add support for the SDIO based RTL8822BS chipset Martin Blumenstingl
2023-03-23 2:29 ` Ping-Ke Shih
2023-03-20 21:35 ` [PATCH v3 8/9] wifi: rtw88: Add support for the SDIO based RTL8822CS chipset Martin Blumenstingl
2023-03-23 2:30 ` Ping-Ke Shih
2023-03-20 21:35 ` [PATCH v3 9/9] wifi: rtw88: Add support for the SDIO based RTL8821CS chipset Martin Blumenstingl
2023-03-23 2:33 ` Ping-Ke Shih
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=33e7ca4c7ba947d68d451e919837f6b7@realtek.com \
--to=pkshih@realtek.com \
--cc=Larry.Finger@lwfinger.net \
--cc=jernej.skrabec@gmail.com \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=macroalpha82@gmail.com \
--cc=martin.blumenstingl@googlemail.com \
--cc=neojou@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nitin.gupta981@gmail.com \
--cc=tony0620emma@gmail.com \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).