Linux wireless drivers development
 help / color / mirror / Atom feed
From: Luca Casati <luk00casati@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: johannes@sipsolutions.net, arend.vanspriel@broadcom.com,
	b43-dev@lists.infradead.org, Luca Casati <luk00casati@gmail.com>
Subject: [PATCH wireless-next 4/5] b43: N-PHY: wait for the first 2057 RC calibration run
Date: Mon, 26 Oct 2026 19:15:42 +0100	[thread overview]
Message-ID: <20261026181543.77763-5-luk00casati@gmail.com> (raw)
In-Reply-To: <20261026181543.77763-1-luk00casati@gmail.com>

RCCAL_DONE_OSCCAP still shows the previous run's done bit for a few us
after a start, and the first (SCAP) run polled it immediately, so the
run was stopped before it happened. RCCAL_SCAP_VAL then read 0 (wl
gets 8 on a BCM43228), which detunes the TX low-pass filter set up in
the rev7+ workarounds. Sleep before polling, as the other two runs do.

Found and fixed with the help of an AI coding assistant (Claude Opus 5.5),
by comparing mmiotraces of b43 and wl on the same card.

Signed-off-by: Luca Casati <luk00casati@gmail.com>
---
 drivers/net/wireless/broadcom/b43/phy_n.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/broadcom/b43/phy_n.c b/drivers/net/wireless/broadcom/b43/phy_n.c
index 44769dbb7..cd50614ff 100644
--- a/drivers/net/wireless/broadcom/b43/phy_n.c
+++ b/drivers/net/wireless/broadcom/b43/phy_n.c
@@ -938,8 +938,15 @@ static u16 b43_radio_2057_rccal(struct b43_wldev *dev)
 	}
 	b43_radio_write(dev, R2057_RCCAL_X1, 0x6E);
 
-	/* Start, wait, stop */
+	/*
+	 * Start, wait, stop. DONE still holds the previous run's done bit
+	 * for a few us after the start, so give the cal time to clear it
+	 * before polling, as for the other two runs. Polling right away
+	 * stopped this (SCAP) cal before it ran and left RCCAL_SCAP_VAL at
+	 * 0, which detunes the TX LPF on radio rev 9.
+	 */
 	b43_radio_write(dev, R2057_RCCAL_START_R1_Q1_P1, 0x55);
+	usleep_range(70, 140);
 	if (!b43_radio_wait_value(dev, R2057_RCCAL_DONE_OSCCAP, 2, 2, 500,
 				  5000000))
 		b43dbg(dev->wl, "Radio 0x2057 rccal timeout\n");
-- 
2.43.0


  parent reply	other threads:[~2026-10-26 18:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 18:15 [PATCH wireless-next 0/5] b43: N-PHY: fix calibrations on rev7+ (BCM43228) Luca Casati
2026-10-26 18:15 ` [PATCH wireless-next 1/5] b43: N-PHY: fix the TX tone sample table Luca Casati
2026-10-26 18:15 ` [PATCH wireless-next 2/5] b43: N-PHY: fix TX IQ/LO calibration Luca Casati
2026-10-26 18:15 ` [PATCH wireless-next 3/5] b43: N-PHY: fix rev3+ RSSI calibration Luca Casati
2026-10-26 18:15 ` Luca Casati [this message]
2026-10-26 18:15 ` [PATCH wireless-next 5/5] b43: N-PHY: add the missing override to the rev7 TX_PU command Luca Casati

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=20261026181543.77763-5-luk00casati@gmail.com \
    --to=luk00casati@gmail.com \
    --cc=arend.vanspriel@broadcom.com \
    --cc=b43-dev@lists.infradead.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /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