[PATCH v3 2/4] firmware: tegra: bpmp: Add per-SoC EMC clock ID

From: Johnny Liu

Date: Mon Nov 02 2026 - 07:35:49 EST


The EMC clock ID differs per chip (TEGRA234_CLK_EMC=31,
TEGRA264_CLK_EMC=290).

Add an emc_clk_id field to struct tegra_bpmp_soc and set it for Tegra234
and Tegra264. The specified EMC clock ID is intended to be used by the
BPMP common clock provider driver to set the CLK_GET_RATE_NOCACHE flag
on that clock. Since the EMC clock is completely managed by the
firmware, the common clock framework must not read back a stale cached
rate, but forcefully pass the request through to the firmware to get the
latest clock rate.

To describe such chip specific properties, give Tegra234 and Tegra264
dedicated SoC data selected through their specific compatibles, built on
top of a common TEGRA186_BPMP_SOC_COMMON initializer. Tegra186 and
Tegra194 keep using tegra186_soc.

Signed-off-by: Johnny Liu <johnliu@xxxxxxxxxx>
---
drivers/firmware/tegra/bpmp.c | 52 +++++++++++++++++++++++------------
include/soc/tegra/bpmp.h | 1 +
2 files changed, 36 insertions(+), 17 deletions(-)

diff --git a/drivers/firmware/tegra/bpmp.c b/drivers/firmware/tegra/bpmp.c
index d3508e98e338..5d97a8600fd1 100644
--- a/drivers/firmware/tegra/bpmp.c
+++ b/drivers/firmware/tegra/bpmp.c
@@ -21,6 +21,9 @@
#include <soc/tegra/bpmp-abi.h>
#include <soc/tegra/ivc.h>

+#include <dt-bindings/clock/nvidia,tegra264.h>
+#include <dt-bindings/clock/tegra234-clock.h>
+
#include "bpmp-private.h"

#define MSG_ACK BIT(0)
@@ -1132,24 +1135,37 @@ static const struct dev_pm_ops tegra_bpmp_pm_ops = {
IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \
IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC) || \
IS_ENABLED(CONFIG_ARCH_TEGRA_264_SOC)
+#define TEGRA186_BPMP_SOC_COMMON \
+ .channels = { \
+ .cpu_tx = { \
+ .offset = 3, \
+ .timeout = 60 * USEC_PER_SEC, \
+ }, \
+ .thread = { \
+ .offset = 0, \
+ .count = 3, \
+ .timeout = 600 * USEC_PER_SEC, \
+ }, \
+ .cpu_rx = { \
+ .offset = 13, \
+ .timeout = 0, \
+ }, \
+ }, \
+ .ops = &tegra186_bpmp_ops, \
+ .num_resets = 193
+
static const struct tegra_bpmp_soc tegra186_soc = {
- .channels = {
- .cpu_tx = {
- .offset = 3,
- .timeout = 60 * USEC_PER_SEC,
- },
- .thread = {
- .offset = 0,
- .count = 3,
- .timeout = 600 * USEC_PER_SEC,
- },
- .cpu_rx = {
- .offset = 13,
- .timeout = 0,
- },
- },
- .ops = &tegra186_bpmp_ops,
- .num_resets = 193,
+ TEGRA186_BPMP_SOC_COMMON,
+};
+
+static const struct tegra_bpmp_soc tegra234_soc = {
+ TEGRA186_BPMP_SOC_COMMON,
+ .emc_clk_id = TEGRA234_CLK_EMC,
+};
+
+static const struct tegra_bpmp_soc tegra264_soc = {
+ TEGRA186_BPMP_SOC_COMMON,
+ .emc_clk_id = TEGRA264_CLK_EMC,
};
#endif

@@ -1182,6 +1198,8 @@ static const struct of_device_id tegra_bpmp_match[] = {
IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC) || \
IS_ENABLED(CONFIG_ARCH_TEGRA_264_SOC)
{ .compatible = "nvidia,tegra186-bpmp", .data = &tegra186_soc },
+ { .compatible = "nvidia,tegra234-bpmp", .data = &tegra234_soc },
+ { .compatible = "nvidia,tegra264-bpmp", .data = &tegra264_soc },
#endif
#if IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC)
{ .compatible = "nvidia,tegra210-bpmp", .data = &tegra210_soc },
diff --git a/include/soc/tegra/bpmp.h b/include/soc/tegra/bpmp.h
index f55db918ccb1..40e2db8e69cc 100644
--- a/include/soc/tegra/bpmp.h
+++ b/include/soc/tegra/bpmp.h
@@ -31,6 +31,7 @@ struct tegra_bpmp_soc {
const struct tegra_bpmp_ops *ops;
const struct tegra_bpmp_mbwt_soc *mbwt;
unsigned int num_resets;
+ unsigned int emc_clk_id;
};

struct tegra_bpmp_mb_data {
--
2.43.0