From: Arend van Spriel <arend@broadcom.com>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
Hante Meuleman <meuleman@broadcom.com>,
Arend van Spriel <arend@broadcom.com>
Subject: [PATCH 08/21] brcmfmac: use device memsize config from fw if defined
Date: Wed, 17 Feb 2016 11:26:57 +0100 [thread overview]
Message-ID: <1455704830-10088-9-git-send-email-arend@broadcom.com> (raw)
In-Reply-To: <1455704830-10088-1-git-send-email-arend@broadcom.com>
From: Hante Meuleman <meuleman@broadcom.com>
Newer type pcie devices have memory which get shared between fw and
hw. The division of this memory is done firmware compile time. As a
result the ramsize as used by driver needs to be adjusted for this.
This is done by reading the memory size from the firmware.
Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
.../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 33 ++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
index d5f9ef4..d89212b 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -207,6 +207,10 @@ static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
#define BRCMF_PCIE_CFGREG_REG_BAR3_CONFIG 0x4F4
#define BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB 3
+/* Magic number at a magic location to find RAM size */
+#define BRCMF_RAMSIZE_MAGIC 0x534d4152 /* SMAR */
+#define BRCMF_RAMSIZE_OFFSET 0x6c
+
struct brcmf_pcie_console {
u32 base_addr;
@@ -1412,6 +1416,28 @@ static const struct brcmf_bus_ops brcmf_pcie_bus_ops = {
};
+static void
+brcmf_pcie_adjust_ramsize(struct brcmf_pciedev_info *devinfo, u8 *data,
+ u32 data_len)
+{
+ __le32 *field;
+ u32 newsize;
+
+ if (data_len < BRCMF_RAMSIZE_OFFSET + 8)
+ return;
+
+ field = (__le32 *)&data[BRCMF_RAMSIZE_OFFSET];
+ if (le32_to_cpup(field) != BRCMF_RAMSIZE_MAGIC)
+ return;
+ field++;
+ newsize = le32_to_cpup(field);
+
+ brcmf_dbg(PCIE, "Found ramsize info in FW, adjusting to 0x%x\n",
+ newsize);
+ devinfo->ci->ramsize = newsize;
+}
+
+
static int
brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo,
u32 sharedram_addr)
@@ -1694,6 +1720,13 @@ static void brcmf_pcie_setup(struct device *dev, const struct firmware *fw,
brcmf_pcie_attach(devinfo);
+ /* Some of the firmwares have the size of the memory of the device
+ * defined inside the firmware. This is because part of the memory in
+ * the device is shared and the devision is determined by FW. Parse
+ * the firmware and adjust the chip memory size now.
+ */
+ brcmf_pcie_adjust_ramsize(devinfo, (u8 *)fw->data, fw->size);
+
ret = brcmf_pcie_download_fw_nvram(devinfo, fw, nvram, nvram_len);
if (ret)
goto fail;
--
1.9.1
next prev parent reply other threads:[~2016-02-17 10:27 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-17 10:26 [PATCH 00/21] brcmfmac: driver setting concept and other changes Arend van Spriel
2016-02-17 10:26 ` [PATCH 01/21] brcmfmac: change function name for brcmf_cfg80211_wait_vif_event_timeout() Arend van Spriel
2016-03-07 12:19 ` [01/21] brcmfmac: change function name forbrcmf_cfg80211_wait_vif_event_timeout() Kalle Valo
2016-03-07 12:49 ` Kalle Valo
2016-03-07 20:03 ` Arend Van Spriel
2016-03-08 8:46 ` Kalle Valo
2016-02-17 10:26 ` [PATCH 02/21] brcmfmac: Limit memory allocs to <64K Arend van Spriel
2016-02-17 10:26 ` [PATCH 03/21] brcmfmac: check for wowl support before enumerating feature flag Arend van Spriel
2016-02-17 10:26 ` [PATCH 04/21] brcmfmac: Configure country code using device specific settings Arend van Spriel
2016-02-17 10:26 ` [PATCH 05/21] brcmfmac: Add length checks on firmware events Arend van Spriel
2016-02-17 10:26 ` [PATCH 06/21] brcmfmac: add neighbor discovery offload ip address table configuration Arend van Spriel
2016-02-17 10:26 ` [PATCH 07/21] brcmfmac: check return for ARP ip setting iovar Arend van Spriel
2016-02-17 10:26 ` Arend van Spriel [this message]
2016-02-17 10:26 ` [PATCH 09/21] brcmfmac: use bar1 window size as provided by pci subsystem Arend van Spriel
2016-02-17 10:26 ` [PATCH 10/21] brcmfmac: add support for the PCIE 4366c0 chip Arend van Spriel
2016-02-17 10:27 ` [PATCH 11/21] brcmfmac: remove pcie gen1 support Arend van Spriel
2016-02-17 10:27 ` [PATCH 12/21] brcmfmac: increase timeout for tx eapol Arend van Spriel
2016-02-17 10:27 ` [PATCH 13/21] brcmfmac: move module init and exit to common Arend van Spriel
2016-02-17 10:27 ` [PATCH 14/21] brcmfmac: add wowl gtk rekeying offload support Arend van Spriel
2016-02-17 10:27 ` [PATCH 15/21] brcmfmac: move platform data retrieval code to common Arend van Spriel
2016-02-17 10:27 ` [PATCH 16/21] brcmfmac: keep ARP and ND offload enabled during WOWL Arend van Spriel
2016-02-17 10:27 ` [PATCH 17/21] brcmfmac: fix sdio sg table alloc crash Arend van Spriel
2016-02-17 10:27 ` [PATCH 18/21] brcmfmac: switch to new platform data Arend van Spriel
2016-03-04 14:49 ` Kalle Valo
2016-03-04 20:02 ` Arend Van Spriel
2016-02-17 10:27 ` [PATCH 19/21] brcmfmac: merge platform data and module paramaters Arend van Spriel
2016-02-17 10:27 ` [PATCH 20/21] brcmfmac: integrate add_keyext in add_key Arend van Spriel
2016-02-17 10:27 ` [PATCH 21/21] brcmfmac: add 802.11w management frame protection support Arend van Spriel
2016-02-25 22:26 ` [PATCH 00/21] brcmfmac: driver setting concept and other changes Rafał Miłecki
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=1455704830-10088-9-git-send-email-arend@broadcom.com \
--to=arend@broadcom.com \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=meuleman@broadcom.com \
/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).