diff mbox series

[09/11] brcmfmac: disable command decode in sdio_aos for 43012/4339/4345

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

Commit Message

Chi-Hsien Lin Nov. 6, 2018, 3:50 a.m. UTC
From: Wright Feng <wright.feng@cypress.com>

Transaction between AOS and SDIOD is not protected, and if cmd 52
received in AOS and in the middle of response state changed from AOS to
SDIOD, response is corrupted and it causes to SDIO Host controller to
hang.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

Arend van Spriel Nov. 8, 2018, 11:54 a.m. UTC | #1
On 11/6/2018 4:50 AM, Chi-Hsien Lin wrote:
> From: Wright Feng <wright.feng@cypress.com>
>
> Transaction between AOS and SDIOD is not protected, and if cmd 52
> received in AOS and in the middle of response state changed from AOS to
> SDIOD, response is corrupted and it causes to SDIO Host controller to
> hang.

I think it would be good to elaborate on what AOS stands for. It is a 
part of the SDIOD core that becomes active when the rest of SDIOD is 
sleeping to keep SDIO bus alive responding to reduced set of commands.

I would actually suggest to collapse patch 10 and 11 in this one.

Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> Signed-off-by: Wright Feng <wright.feng@cypress.com>
> Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
> ---
>  drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
> index e7ee144dc5dd..d507d8f15e48 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
> @@ -3363,15 +3363,21 @@ static void brcmf_sdio_sr_init(struct brcmf_sdio *bus)
>
>  	if (bus->ci->chip == CY_CC_43012_CHIP_ID) {
>  		wakeupctrl = SBSDIO_FUNC1_WCTRL_ALPWAIT_SHIFT;
> -		cardcap = SDIO_CCCR_BRCM_CARDCAP_CMD_NODEC;
>  		chipclkcsr = SBSDIO_HT_AVAIL_REQ;
>  	} else {
>  		wakeupctrl = SBSDIO_FUNC1_WCTRL_HTWAIT_SHIFT;
> -		cardcap = (SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT |
> -				   SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT);
>  		chipclkcsr = SBSDIO_FORCE_HT;
>  	}
>
> +	if (bus->ci->chip == CY_CC_43012_CHIP_ID ||
> +	    bus->ci->chip == BRCM_CC_4339_CHIP_ID ||
> +	    bus->ci->chip == BRCM_CC_4345_CHIP_ID) {

use brcmf_sdio_aos_no_decode(bus) helper here.

> +		cardcap = SDIO_CCCR_BRCM_CARDCAP_CMD_NODEC;
> +	} else {
> +		cardcap = (SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT |
> +			   SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT);
> +	}
> +
>  	val = brcmf_sdiod_readb(bus->sdiodev, SBSDIO_FUNC1_WAKEUPCTRL, &err);
>  	if (err) {
>  		brcmf_err("error reading SBSDIO_FUNC1_WAKEUPCTRL\n");
>
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 e7ee144dc5dd..d507d8f15e48 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -3363,15 +3363,21 @@  static void brcmf_sdio_sr_init(struct brcmf_sdio *bus)
 
 	if (bus->ci->chip == CY_CC_43012_CHIP_ID) {
 		wakeupctrl = SBSDIO_FUNC1_WCTRL_ALPWAIT_SHIFT;
-		cardcap = SDIO_CCCR_BRCM_CARDCAP_CMD_NODEC;
 		chipclkcsr = SBSDIO_HT_AVAIL_REQ;
 	} else {
 		wakeupctrl = SBSDIO_FUNC1_WCTRL_HTWAIT_SHIFT;
-		cardcap = (SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT |
-				   SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT);
 		chipclkcsr = SBSDIO_FORCE_HT;
 	}
 
+	if (bus->ci->chip == CY_CC_43012_CHIP_ID ||
+	    bus->ci->chip == BRCM_CC_4339_CHIP_ID ||
+	    bus->ci->chip == BRCM_CC_4345_CHIP_ID) {
+		cardcap = SDIO_CCCR_BRCM_CARDCAP_CMD_NODEC;
+	} else {
+		cardcap = (SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT |
+			   SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT);
+	}
+
 	val = brcmf_sdiod_readb(bus->sdiodev, SBSDIO_FUNC1_WAKEUPCTRL, &err);
 	if (err) {
 		brcmf_err("error reading SBSDIO_FUNC1_WAKEUPCTRL\n");