From: Alessio Ferri <alessio.ferri@mythread.it>
To: "Rafał Miłecki" <zajec5@gmail.com>, "Michael Buesch" <m@bues.ch>,
vit9696 <vit9696@protonmail.com>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mips@vger.kernel.org,
Alessio Ferri <alessio.ferri@mythread.it>
Subject: [PATCH wireless-next v2 2/8] bcma: pmu: init PLL and resources on BCM4352/BCM4360
Date: Tue, 27 Oct 2026 00:53:45 +0100 [thread overview]
Message-ID: <20261027-bcma-ac-rev1-v2-2-b69b61c31920@mythread.it> (raw)
In-Reply-To: <20261027-bcma-ac-rev1-v2-0-b69b61c31920@mythread.it>
On chip rev 3:
- program PLLCTL2/3 for a 960.0098 MHz fractional VCO from the 40 MHz
crystal, except on a BCM4360 strapped for USB;
- set the up/down time of resource 6;
- with chipstatus RSRC_INIT_MODE0 clear, program PLLCTL6/14 and set
max_res_mask to 0x1ff.
The values are those of Broadcom's driver on rev 3; other revisions are
left as they are.
Signed-off-by: Alessio Ferri <alessio.ferri@mythread.it>
---
drivers/bcma/driver_chipcommon_pmu.c | 41 +++++++++++++++++++++++++++++
include/linux/bcma/bcma_driver_chipcommon.h | 4 +++
2 files changed, 45 insertions(+)
diff --git a/drivers/bcma/driver_chipcommon_pmu.c b/drivers/bcma/driver_chipcommon_pmu.c
index 263ef6fa1..ab2b2701d 100644
--- a/drivers/bcma/driver_chipcommon_pmu.c
+++ b/drivers/bcma/driver_chipcommon_pmu.c
@@ -145,6 +145,39 @@ static void bcma_pmu2_pll_init0(struct bcma_drv_cc *cc, u32 xtalfreq)
/* TODO: Do we need to update OTP? */
}
+static void bcma_pmu_4360_pll_init(struct bcma_drv_cc *cc)
+{
+ struct bcma_bus *bus = cc->core->bus;
+
+ if (bus->chipinfo.rev != 3)
+ return;
+ if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4360 &&
+ cc->status & BCMA_CC_CHIPST_4360_MODE_USB)
+ return;
+
+ /* Fractional VCO, 960.0098 MHz from a 40 MHz crystal. */
+ bcma_chipco_pll_write(cc, BCMA_CC_PMU_PLL_CTL2, 0x0c31);
+ bcma_chipco_pll_write(cc, BCMA_CC_PMU_PLL_CTL3, 0x100e);
+ bcma_pmu_set32(cc, BCMA_CC_PMU_CTL, BCMA_CC_PMU_CTL_PLL_UPD);
+}
+
+/* Returns the max resource mask to program, 0 to leave it alone. */
+static u32 bcma_pmu_4360_resources_init(struct bcma_drv_cc *cc)
+{
+ if (cc->core->bus->chipinfo.rev != 3)
+ return 0;
+
+ bcma_pmu_write32(cc, BCMA_CC_PMU_RES_TABSEL, 6);
+ bcma_pmu_write32(cc, BCMA_CC_PMU_RES_UPDNTM, 0x00200001);
+
+ if (cc->status & BCMA_CC_CHIPST_4360_RSRC_INIT_MODE0)
+ return 0;
+ bcma_chipco_pll_write(cc, BCMA_CC_PMU_PLL_CTL6, 0x09048562);
+ bcma_chipco_pll_write(cc, BCMA_CC_PMU_PLL_CTL14, 0x09048562);
+ bcma_pmu_set32(cc, BCMA_CC_PMU_CTL, BCMA_CC_PMU_CTL_PLL_UPD);
+ return 0x1ff;
+}
+
static void bcma_pmu_pll_init(struct bcma_drv_cc *cc)
{
struct bcma_bus *bus = cc->core->bus;
@@ -156,6 +189,10 @@ static void bcma_pmu_pll_init(struct bcma_drv_cc *cc)
xtalfreq = 20000;
bcma_pmu2_pll_init0(cc, xtalfreq);
break;
+ case BCMA_CHIP_ID_BCM4352:
+ case BCMA_CHIP_ID_BCM4360:
+ bcma_pmu_4360_pll_init(cc);
+ break;
}
}
@@ -188,6 +225,10 @@ static void bcma_pmu_resources_init(struct bcma_drv_cc *cc)
BCMA_RES_4314_WL_CORE_READY;
max_msk = 0x3FFFFFFF;
break;
+ case BCMA_CHIP_ID_BCM4352:
+ case BCMA_CHIP_ID_BCM4360:
+ max_msk = bcma_pmu_4360_resources_init(cc);
+ break;
default:
bcma_debug(bus, "PMU resource config unknown or not needed for device 0x%04X\n",
bus->chipinfo.id);
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 0cb6638b5..45c37b6bd 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -107,6 +107,8 @@
#define BCMA_CC_CHIPST_4706_PCIE1_DISABLE BIT(5) /* PCIE1 enable strap pin */
#define BCMA_CC_CHIPST_5357_NAND_BOOT BIT(4) /* NAND boot, valid for CC rev 38 and/or BCM5357 */
#define BCMA_CC_CHIPST_4360_XTAL_40MZ 0x00000001
+#define BCMA_CC_CHIPST_4360_RSRC_INIT_MODE0 0x00000020
+#define BCMA_CC_CHIPST_4360_MODE_USB 0x00000100
#define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */
#define BCMA_CC_JCMD_START 0x80000000
#define BCMA_CC_JCMD_BUSY 0x80000000
@@ -500,6 +502,8 @@
#define BCMA_CC_PMU_PLL_CTL3 3
#define BCMA_CC_PMU_PLL_CTL4 4
#define BCMA_CC_PMU_PLL_CTL5 5
+#define BCMA_CC_PMU_PLL_CTL6 6
+#define BCMA_CC_PMU_PLL_CTL14 14
#define BCMA_CC_PMU1_PLL0_PC0_P1DIV_MASK 0x00f00000
#define BCMA_CC_PMU1_PLL0_PC0_P1DIV_SHIFT 20
--
2.34.1
next prev parent reply other threads:[~2026-10-26 23:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 23:53 [PATCH wireless-next v2 0/8] bcma-ac-rev1: support 4352/4360 rev3 chips Alessio Ferri
2026-10-26 23:53 ` [PATCH wireless-next v2 1/8] bcma: core: clear only FORCEHT for BCMA_CLKMODE_DYNAMIC Alessio Ferri
2026-10-26 23:53 ` Alessio Ferri [this message]
2026-10-28 0:44 ` [PATCH wireless-next v2 2/8] bcma: pmu: init PLL and resources on BCM4352/BCM4360 vit9696
2026-10-28 9:14 ` Alessio Ferri
2026-10-28 13:34 ` vit9696
2026-10-26 23:53 ` [PATCH wireless-next v2 3/8] bcma: pcie2: request HT " Alessio Ferri
2026-10-28 11:40 ` vit9696
2026-10-26 23:53 ` [PATCH wireless-next v2 4/8] bcma: chipcommon: enable asynchronous GPIO interrupts Alessio Ferri
2026-10-26 23:53 ` [PATCH wireless-next v2 5/8] bcma: extract SPROM revision 11 Alessio Ferri
2026-10-26 23:53 ` [PATCH wireless-next v2 6/8] firmware: bcm47xx_sprom: read ledbh4..ledbh15 from NVRAM Alessio Ferri
2026-10-28 12:43 ` vit9696
2026-10-26 23:53 ` [PATCH wireless-next v2 7/8] firmware: bcm47xx_sprom: read boardflags3 and AvVmid_c0..2 " Alessio Ferri
2026-10-28 13:27 ` vit9696
2026-10-26 23:53 ` [PATCH wireless-next v2 8/8] bcma: add the BCM4352 PCI ID Alessio Ferri
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=20261027-bcma-ac-rev1-v2-2-b69b61c31920@mythread.it \
--to=alessio.ferri@mythread.it \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=m@bues.ch \
--cc=vit9696@protonmail.com \
--cc=zajec5@gmail.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
all inboxes | Powered by JetHome®