Commit 098e0b10 authored by Hector Martin's avatar Hector Martin Committed by Kalle Valo

wifi: brcmfmac: chip: Handle 1024-unit sizes for TCM blocks

BCM4387 has trailing odd-sized blocks as part of TCM which have
their size described as a multiple of 1024 instead of 8192. Handle this
so we can compute the TCM size properly.
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Reviewed-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: default avatarHector Martin <marcan@marcan.st>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230214092423.15175-2-marcan@marcan.st
parent 3c7c07ca
...@@ -212,8 +212,9 @@ struct sbsocramregs { ...@@ -212,8 +212,9 @@ struct sbsocramregs {
#define ARMCR4_TCBANB_MASK 0xf #define ARMCR4_TCBANB_MASK 0xf
#define ARMCR4_TCBANB_SHIFT 0 #define ARMCR4_TCBANB_SHIFT 0
#define ARMCR4_BSZ_MASK 0x3f #define ARMCR4_BSZ_MASK 0x7f
#define ARMCR4_BSZ_MULT 8192 #define ARMCR4_BSZ_MULT 8192
#define ARMCR4_BLK_1K_MASK 0x200
struct brcmf_core_priv { struct brcmf_core_priv {
struct brcmf_core pub; struct brcmf_core pub;
...@@ -684,6 +685,7 @@ static u32 brcmf_chip_tcm_ramsize(struct brcmf_core_priv *cr4) ...@@ -684,6 +685,7 @@ static u32 brcmf_chip_tcm_ramsize(struct brcmf_core_priv *cr4)
u32 nbb; u32 nbb;
u32 totb; u32 totb;
u32 bxinfo; u32 bxinfo;
u32 blksize;
u32 idx; u32 idx;
corecap = brcmf_chip_core_read32(cr4, ARMCR4_CAP); corecap = brcmf_chip_core_read32(cr4, ARMCR4_CAP);
...@@ -695,7 +697,11 @@ static u32 brcmf_chip_tcm_ramsize(struct brcmf_core_priv *cr4) ...@@ -695,7 +697,11 @@ static u32 brcmf_chip_tcm_ramsize(struct brcmf_core_priv *cr4)
for (idx = 0; idx < totb; idx++) { for (idx = 0; idx < totb; idx++) {
brcmf_chip_core_write32(cr4, ARMCR4_BANKIDX, idx); brcmf_chip_core_write32(cr4, ARMCR4_BANKIDX, idx);
bxinfo = brcmf_chip_core_read32(cr4, ARMCR4_BANKINFO); bxinfo = brcmf_chip_core_read32(cr4, ARMCR4_BANKINFO);
memsize += ((bxinfo & ARMCR4_BSZ_MASK) + 1) * ARMCR4_BSZ_MULT; blksize = ARMCR4_BSZ_MULT;
if (bxinfo & ARMCR4_BLK_1K_MASK)
blksize >>= 3;
memsize += ((bxinfo & ARMCR4_BSZ_MASK) + 1) * blksize;
} }
return memsize; return memsize;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment