Skip to content

Commit 487c407

Browse files
cris-masudeep-holla
authored andcommitted
firmware: arm_scmi: Add common framework to handle firmware quirks
Add a common framework to describe SCMI quirks and associate them with a specific platform or a specific set of SCMI firmware versions. All the matching SCMI quirks will be enabled when the SCMI core stack probes and after all the needed SCMI firmware versioning information was retrieved using the base protocol. Tested-by: Johan Hovold <[email protected]> Signed-off-by: Cristian Marussi <[email protected]> Message-Id: <[email protected]> Signed-off-by: Sudeep Holla <[email protected]>
1 parent 94a263f commit 487c407

File tree

5 files changed

+398
-1
lines changed

5 files changed

+398
-1
lines changed

drivers/firmware/arm_scmi/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,19 @@ config ARM_SCMI_DEBUG_COUNTERS
6969
such useful debug counters. This can be helpful for debugging and
7070
SCMI monitoring.
7171

72+
config ARM_SCMI_QUIRKS
73+
bool "Enable SCMI Quirks framework"
74+
depends on JUMP_LABEL || COMPILE_TEST
75+
default y
76+
help
77+
Enables support for SCMI Quirks framework to workaround SCMI platform
78+
firmware bugs on system already deployed in the wild.
79+
80+
The framework allows the definition of platform-specific code quirks
81+
that will be associated and enabled only on the desired platforms
82+
depending on the SCMI firmware advertised versions and/or machine
83+
compatibles.
84+
7285
source "drivers/firmware/arm_scmi/transports/Kconfig"
7386
source "drivers/firmware/arm_scmi/vendors/imx/Kconfig"
7487

drivers/firmware/arm_scmi/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ scmi-bus-y = bus.o
33
scmi-core-objs := $(scmi-bus-y)
44

55
scmi-driver-y = driver.o notify.o
6+
scmi-driver-$(CONFIG_ARM_SCMI_QUIRKS) += quirks.o
67
scmi-driver-$(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT) += raw_mode.o
78
scmi-transport-$(CONFIG_ARM_SCMI_HAVE_SHMEM) = shmem.o
89
scmi-transport-$(CONFIG_ARM_SCMI_HAVE_MSG) += msg.o

drivers/firmware/arm_scmi/driver.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* various power domain DVFS including the core/cluster, certain system
1212
* clocks configuration, thermal sensors and many others.
1313
*
14-
* Copyright (C) 2018-2024 ARM Ltd.
14+
* Copyright (C) 2018-2025 ARM Ltd.
1515
*/
1616

1717
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -38,6 +38,7 @@
3838

3939
#include "common.h"
4040
#include "notify.h"
41+
#include "quirks.h"
4142

4243
#include "raw_mode.h"
4344

@@ -3102,6 +3103,18 @@ static const struct scmi_desc *scmi_transport_setup(struct device *dev)
31023103
return &trans->desc;
31033104
}
31043105

3106+
static void scmi_enable_matching_quirks(struct scmi_info *info)
3107+
{
3108+
struct scmi_revision_info *rev = &info->version;
3109+
3110+
dev_dbg(info->dev, "Looking for quirks matching: %s/%s/0x%08X\n",
3111+
rev->vendor_id, rev->sub_vendor_id, rev->impl_ver);
3112+
3113+
/* Enable applicable quirks */
3114+
scmi_quirks_enable(info->dev, rev->vendor_id,
3115+
rev->sub_vendor_id, rev->impl_ver);
3116+
}
3117+
31053118
static int scmi_probe(struct platform_device *pdev)
31063119
{
31073120
int ret;
@@ -3223,6 +3236,8 @@ static int scmi_probe(struct platform_device *pdev)
32233236
list_add_tail(&info->node, &scmi_list);
32243237
mutex_unlock(&scmi_list_mutex);
32253238

3239+
scmi_enable_matching_quirks(info);
3240+
32263241
for_each_available_child_of_node(np, child) {
32273242
u32 prot_id;
32283243

@@ -3381,6 +3396,8 @@ static struct dentry *scmi_debugfs_init(void)
33813396

33823397
static int __init scmi_driver_init(void)
33833398
{
3399+
scmi_quirks_initialize();
3400+
33843401
/* Bail out if no SCMI transport was configured */
33853402
if (WARN_ON(!IS_ENABLED(CONFIG_ARM_SCMI_HAVE_TRANSPORT)))
33863403
return -EINVAL;

0 commit comments

Comments
 (0)