-/* $OpenBSD: bwfm.c,v 1.93 2021/12/26 20:50:17 patrick Exp $ */
+/* $OpenBSD: bwfm.c,v 1.94 2021/12/27 10:59:20 patrick Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
* Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se>
void
bwfm_chip_tcm_ramsize(struct bwfm_softc *sc, struct bwfm_core *core)
{
- uint32_t cap, nab, nbb, totb, bxinfo, ramsize = 0;
+ uint32_t cap, nab, nbb, totb, bxinfo, blksize, ramsize = 0;
int i;
cap = sc->sc_buscore_ops->bc_read(sc, core->co_base + BWFM_ARMCR4_CAP);
core->co_base + BWFM_ARMCR4_BANKIDX, i);
bxinfo = sc->sc_buscore_ops->bc_read(sc,
core->co_base + BWFM_ARMCR4_BANKINFO);
+ if (bxinfo & BWFM_ARMCR4_BANKINFO_BLK_1K_MASK)
+ blksize = 1024;
+ else
+ blksize = 8192;
ramsize += ((bxinfo & BWFM_ARMCR4_BANKINFO_BSZ_MASK) + 1) *
- BWFM_ARMCR4_BANKINFO_BSZ_MULT;
+ blksize;
}
sc->sc_chip.ch_ramsize = ramsize;
-/* $OpenBSD: bwfmreg.h,v 1.22 2021/12/26 20:50:17 patrick Exp $ */
+/* $OpenBSD: bwfmreg.h,v 1.23 2021/12/27 10:59:20 patrick Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
* Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se>
#define BWFM_ARMCR4_CAP_TCBBNB_SHIFT 4
#define BWFM_ARMCR4_BANKIDX 0x0040
#define BWFM_ARMCR4_BANKINFO 0x0044
-#define BWFM_ARMCR4_BANKINFO_BSZ_MASK 0x3f
-#define BWFM_ARMCR4_BANKINFO_BSZ_MULT 8192
+#define BWFM_ARMCR4_BANKINFO_BSZ_MASK 0x7f
+#define BWFM_ARMCR4_BANKINFO_BLK_1K_MASK 0x200
#define BWFM_ARMCR4_BANKPDA 0x004C
/* GCI (OTP) registers */