From: Alessio Ferri <alessio.ferri@mythread.it>
To: "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Rafał Miłecki" <zajec5@gmail.com>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
"Florian Fainelli" <florian.fainelli@broadcom.com>,
"Broadcom internal kernel review list"
<bcm-kernel-feedback-list@broadcom.com>,
"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>
Cc: linux-wireless@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org,
Alessio Ferri <alessio.ferri@mythread.it>
Subject: [PATCH v2 2/5] bcma: scan: support big-endian backplanes
Date: Mon, 12 Oct 2026 00:45:26 +0200 [thread overview]
Message-ID: <20261012-bcm6362-wlan-v2-2-4752da7e0982@mythread.it> (raw)
In-Reply-To: <20261012-bcm6362-wlan-v2-0-4752da7e0982@mythread.it>
On some SoCs the bcma backplane is a big-endian peripheral, so the
ChipCommon ID/EROM pointer registers and the EROM itself read wrong
with readl().
Add a big_endian flag to struct bcma_bus, set by the host driver
before bcma_init_bus(), and use ioread32be() for scan-time accesses
when it is set. Core register accesses after the scan already go
through the host ops, which the host driver provides with the right
endianness.
Nothing changes for other devices.
Assisted-by: LLM sparse
Signed-off-by: Alessio Ferri <alessio.ferri@mythread.it>
---
drivers/bcma/scan.c | 4 +++-
include/linux/bcma/bcma.h | 3 +++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c
index 84742408a59c..983a62ddeebb 100644
--- a/drivers/bcma/scan.c
+++ b/drivers/bcma/scan.c
@@ -143,6 +143,8 @@ static const char *bcma_device_name(const struct bcma_device_id *id)
static u32 bcma_scan_read32(struct bcma_bus *bus, u16 offset)
{
+ if (bus->big_endian)
+ return ioread32be(bus->mmio + offset);
return readl(bus->mmio + offset);
}
@@ -155,7 +157,7 @@ static void bcma_scan_switch_core(struct bcma_bus *bus, u32 addr)
static u32 bcma_erom_get_ent(struct bcma_bus *bus, u32 __iomem **eromptr)
{
- u32 ent = readl(*eromptr);
+ u32 ent = bus->big_endian ? ioread32be(*eromptr) : readl(*eromptr);
(*eromptr)++;
return ent;
}
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 17fc50190014..7ab2b21e7238 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -362,6 +362,9 @@ struct bcma_bus {
/* We decided to share SPROM struct with SSB as long as we do not need
* any hacks for BCMA. This simplifies drivers code. */
struct ssb_sprom sprom;
+
+ /* Backplane registers, EROM included, are big-endian */
+ bool big_endian;
};
static inline u32 bcma_read8(struct bcma_device *core, u16 offset)
--
2.56.0
next prev parent reply other threads:[~2026-10-11 22:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 22:45 [PATCH v2 0/5] bcma: support the BCM6362 integrated WLAN backplane Alessio Ferri
2026-10-11 22:45 ` [PATCH v2 1/5] dt-bindings: bus: add Broadcom BCM6362 WLAN AXI backplane Alessio Ferri
2026-10-12 19:13 ` Conor Dooley
2026-10-13 16:09 ` Alessio Ferri
2026-10-13 16:42 ` Conor Dooley
2026-10-11 22:45 ` Alessio Ferri [this message]
2026-10-11 22:45 ` [PATCH v2 3/5] bcma: scan: accept wrapper-less cores on wrapper-less backplanes Alessio Ferri
2026-10-11 22:45 ` [PATCH v2 4/5] bcma: add host driver for the BCM6362 integrated WLAN backplane Alessio Ferri
2026-10-11 22:45 ` [PATCH v2 5/5] MIPS: dts: bcm6362: add the " Alessio Ferri
2026-10-13 12:29 ` [PATCH v2 0/5] bcma: support the BCM6362 " Johannes Berg
2026-10-13 12:56 ` Alessio Ferri
2026-10-13 16:16 ` Alessio Ferri
2026-10-13 16:25 ` Florian Fainelli
2026-10-13 17:26 ` 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=20261012-bcm6362-wlan-v2-2-4752da7e0982@mythread.it \
--to=alessio.ferri@mythread.it \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=tsbogend@alpha.franken.de \
--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®