diff mbox series

[V2,3/8] brcmfmac: set SDIO F1 MesBusyCtrl for CYW4373

Message ID 1542007730-47284-4-git-send-email-chi-hsien.lin@cypress.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series brcmfmac: chip related changes | expand

Commit Message

Chi-Hsien Lin Nov. 12, 2018, 7:29 a.m. UTC
From: Madhan Mohan R <MadhanMohan.R@cypress.com>

Along with F2 watermark (existing) configuration, F1 MesBusyCtrl
should be enabled & configured to avoid overflow errors.

Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Madhan Mohan R <madhanmohan.r@cypress.com>
Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 3 +++
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h | 3 +++
 2 files changed, 6 insertions(+)

Comments

Arend van Spriel Nov. 12, 2018, 9:13 a.m. UTC | #1
On 11/12/2018 8:29 AM, Chi-Hsien Lin wrote:
> From: Madhan Mohan R <MadhanMohan.R@cypress.com>
>
> Along with F2 watermark (existing) configuration, F1 MesBusyCtrl
> should be enabled & configured to avoid overflow errors.

I am a bit confused. Why is it necessary to program the watermark in 
both SBSDIO_WATERMARK (0x10008) and SDSDIO_FUNC1_MESBUSYCTRL (0x1001D).
Looks suspicious to me.

Regards,
Arend
Madhan Mohan R Nov. 20, 2018, 8:50 a.m. UTC | #2
On Mon, Nov 12, 2018 at 10:13:07AM +0100, Arend van Spriel wrote:
> On 11/12/2018 8:29 AM, Chi-Hsien Lin wrote:
> >From: Madhan Mohan R <MadhanMohan.R@cypress.com>
> >
> >Along with F2 watermark (existing) configuration, F1 MesBusyCtrl
> >should be enabled & configured to avoid overflow errors.
> 
> I am a bit confused. Why is it necessary to program the watermark in
> both SBSDIO_WATERMARK (0x10008) and SDSDIO_FUNC1_MESBUSYCTRL
> (0x1001D).
> Looks suspicious to me.
> 
> Regards,
> Arend

Hi Arend,

Register SDSDIO_FUNC1_MESBUSYCTRL(0x1001D) Bits [6:0] is programmed with
SDIO RX path watermark whereas the register SBSDIO_WATERMARK(0x10008) is
for the SDIO TX path.

Regards,
Madhan
Arend van Spriel Nov. 20, 2018, 9:53 a.m. UTC | #3
On 11/20/2018 9:50 AM, Madhan Mohan R wrote:
> On Mon, Nov 12, 2018 at 10:13:07AM +0100, Arend van Spriel wrote:
>> On 11/12/2018 8:29 AM, Chi-Hsien Lin wrote:
>>> From: Madhan Mohan R <MadhanMohan.R@cypress.com>
>>>
>>> Along with F2 watermark (existing) configuration, F1 MesBusyCtrl
>>> should be enabled & configured to avoid overflow errors.
>>
>> I am a bit confused. Why is it necessary to program the watermark in
>> both SBSDIO_WATERMARK (0x10008) and SDSDIO_FUNC1_MESBUSYCTRL
>> (0x1001D).
>> Looks suspicious to me.
>>
>> Regards,
>> Arend
>
> Hi Arend,
>
> Register SDSDIO_FUNC1_MESBUSYCTRL(0x1001D) Bits [6:0] is programmed with
> SDIO RX path watermark whereas the register SBSDIO_WATERMARK(0x10008) is
> for the SDIO TX path.

Thanks, Madhan

That makes sense. Maybe it would be good to express the tx vs rx detail 
in the code.

Regards,
Arend
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index 05b8cfea5f9f..b9ec40cc7d6b 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -4119,6 +4119,9 @@  static void brcmf_sdio_firmware_callback(struct device *dev, int err,
 			devctl |= SBSDIO_DEVCTL_F2WM_ENAB;
 			brcmf_sdiod_writeb(sdiod, SBSDIO_DEVICE_CTL, devctl,
 					   &err);
+			brcmf_sdiod_writeb(sdiod, SBSDIO_FUNC1_MESBUSYCTRL,
+					   CY_4373_F2_WATERMARK |
+					   SBSDIO_MESBUSYCTRL_ENAB, &err);
 			break;
 		default:
 			brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK,
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
index 7faed831f07d..8aaabca1eb0e 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
@@ -104,6 +104,9 @@ 
 #define SBSDIO_FUNC1_RFRAMEBCHI		0x1001C
 /* MesBusyCtl (rev 11) */
 #define SBSDIO_FUNC1_MESBUSYCTRL	0x1001D
+/* Enable busy capability for MES access */
+#define SBSDIO_MESBUSYCTRL_ENAB         0x80
+
 /* Sdio Core Rev 12 */
 #define SBSDIO_FUNC1_WAKEUPCTRL		0x1001E
 #define SBSDIO_FUNC1_WCTRL_ALPWAIT_MASK		0x1