diff mbox

[29/34] brcmfmac: stabilise the value of ->sbwad in use for some xfer routines.

Message ID 20170726202557.15632-30-ian@mnementh.co.uk (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show

Commit Message

Ian Molton July 26, 2017, 8:25 p.m. UTC
The IO functions operate within the Chipcommon IO window. Explicitly
set this, rather than relying on the last initialisation IO access to
leave it set to the right value by chance.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 8 ++++----
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c   | 5 +++++
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h   | 1 +
 3 files changed, 10 insertions(+), 4 deletions(-)

Comments

Arend van Spriel Aug. 7, 2017, 12:32 p.m. UTC | #1
So now I jump to this patch
On 7/26/2017 10:25 PM, Ian Molton wrote:
> The IO functions operate within the Chipcommon IO window. Explicitly
> set this, rather than relying on the last initialisation IO access to
> leave it set to the right value by chance.

> Signed-off-by: Ian Molton <ian@mnementh.co.uk>
> ---
>   drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 8 ++++----
>   drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c   | 5 +++++
>   drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h   | 1 +
>   3 files changed, 10 insertions(+), 4 deletions(-)
>

[...]

> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
> index fb4f24dfc99d..1ab95011adb0 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
> @@ -178,6 +178,7 @@ struct brcmf_sdio_dev {
>   	struct sdio_func *func[SDIO_MAX_FUNCS];
>   	u8 num_funcs;			/* Supported funcs on client */
>   	u32 sbwad;			/* Save backplane window address */
> +	struct brcmf_core *cc_core;	/* chipcommon core info struct */

We actually just need the chipcommon base address so why not have that 
here, ie.:
+	u32 cc_base;

Another option is to simple use SI_ENUM_BASE as the chipcommon base 
address will always be 0x18000000 for the SDIO chips.

>   	struct brcmf_sdio *bus;
>   	struct device *dev;
>   	struct brcmf_bus *bus_if;
>
Ian Molton Aug. 19, 2017, 8:31 p.m. UTC | #2
On 07/08/17 13:32, Arend van Spriel wrote:
> 
> We actually just need the chipcommon base address so why not have that
> here, ie.:
> +    u32 cc_base;

I see no advantage to that - the u32 is the same size as (or not much
bigger than the pointer to the struct brcmf_core, and my approach makes
it clear where the value came from rather than making another copy of it.

> Another option is to simple use SI_ENUM_BASE as the chipcommon base
> address will always be 0x18000000 for the SDIO chips.

I don't like this approach. Why bother probing the core if we then dont
use the values returned? May as well hard code everything... Also not
futureproof.

-Ian
diff mbox

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
index 6884d1f0b935..26b39f0ffdd4 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
@@ -529,7 +529,7 @@  int brcmf_sdiod_recv_buf(struct brcmf_sdio_dev *sdiodev, u8 *buf, uint nbytes)
 
 int brcmf_sdiod_recv_pkt(struct brcmf_sdio_dev *sdiodev, struct sk_buff *pkt)
 {
-	u32 addr = sdiodev->sbwad;
+	u32 addr = sdiodev->cc_core->base;
 	int err = 0;
 
 	brcmf_dbg(SDIO, "addr = 0x%x, size = %d\n", addr, pkt->len);
@@ -552,7 +552,7 @@  int brcmf_sdiod_recv_chain(struct brcmf_sdio_dev *sdiodev,
 {
 	struct sk_buff *glom_skb = NULL;
 	struct sk_buff *skb;
-	u32 addr = sdiodev->sbwad;
+	u32 addr = sdiodev->cc_core->base;
 	int err = 0;
 
 	brcmf_dbg(SDIO, "addr = 0x%x, size = %d\n",
@@ -593,7 +593,7 @@  int brcmf_sdiod_recv_chain(struct brcmf_sdio_dev *sdiodev,
 int brcmf_sdiod_send_buf(struct brcmf_sdio_dev *sdiodev, u8 *buf, uint nbytes)
 {
 	struct sk_buff *mypkt;
-	u32 addr = sdiodev->sbwad;
+	u32 addr = sdiodev->cc_core->base;
 	int err;
 
 	mypkt = brcmu_pkt_buf_get_skb(nbytes);
@@ -626,7 +626,7 @@  int brcmf_sdiod_send_pkt(struct brcmf_sdio_dev *sdiodev,
 			 struct sk_buff_head *pktq)
 {
 	struct sk_buff *skb;
-	u32 addr = sdiodev->sbwad;
+	u32 addr = sdiodev->cc_core->base;
 	int err;
 
 	brcmf_dbg(SDIO, "addr = 0x%x, size = %d\n", addr, pktq->qlen);
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index b06018e589bb..91a17ef63a6b 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -3838,6 +3838,11 @@  brcmf_sdio_probe_attach(struct brcmf_sdio *bus)
 	if (!bus->sdio_core)
 		goto fail;
 
+	/* Pick up the CHIPCOMMON core info struct, for bulk IO in bcmsdh.c */
+	sdiodev->cc_core = brcmf_chip_get_core(bus->ci, BCMA_CORE_CHIPCOMMON);
+	if (!sdiodev->cc_core)
+		goto fail;
+
 	sdiodev->settings = brcmf_get_module_param(sdiodev->dev,
 						   BRCMF_BUSTYPE_SDIO,
 						   bus->ci->chip,
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
index fb4f24dfc99d..1ab95011adb0 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
@@ -178,6 +178,7 @@  struct brcmf_sdio_dev {
 	struct sdio_func *func[SDIO_MAX_FUNCS];
 	u8 num_funcs;			/* Supported funcs on client */
 	u32 sbwad;			/* Save backplane window address */
+	struct brcmf_core *cc_core;	/* chipcommon core info struct */
 	struct brcmf_sdio *bus;
 	struct device *dev;
 	struct brcmf_bus *bus_if;