mirror of
https://github.com/torvalds/linux.git
synced 2026-05-21 13:27:57 +02:00
Arm SCMI updates for 6.14
This mainly has 2 updates:
1. Extension of the transport properties read from devicetree to support
multiple SCMI platform/server instances
2. Addition of the capability to automatically load the proper SCMI vendor
protocol module. The vendor protocol selection is already provided by
the SCMI core while the automatic loading of vendor protocols was not.
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEEunHlEgbzHrJD3ZPhAEG6vDF+4pgFAmd2sQwACgkQAEG6vDF+
4pgpoQ/+MOZtbUdOQq3VcR/6Fy4zT0+IQRHk58VdX2AxNg1N81ZjufNlL9RJyAaP
TWAHus76Q8MN6lHqPf985XHZmLy4y/CYmB31tAfygIzl8Hz3uOXP3dQ7Km2mjDNi
Die6aD01hK4MMAcRmksh5EW5YELOiN4t1zjA+qcz7oruM7/q1xr1JKgbZ2pXZeJH
wyAIYSdxeWA3MTNbGLlpH8rME1eOTe4rdSzaYihtHm6eqYgLVYtOsdzbtXdr5XRa
OxCZK5krf4e2QoXl6NAuvv/v+Zo6jN5JwKZ5Kik224seJffivDBRLBIj1C/k1ygq
LbDxolR9PLXl/J0rP9LldgPCzNoSA/2ArO2n3XMsk8RljrywXQEjQw7VxOWM7WAs
TzIn+I68NRp86SiQO6dBgN9X7vqkmXeo0EX9gVZzDn6WQ6vkaOJbP54gPzHgDQTB
0tgPpdbR/aOM/URwqYFnY/iR2Bu6axEI3JKQm9sO9erU6sgIqizwZARJNtyj7HIt
6fo4D8f9NZMMUEuzHkzYsMaKdmfVQcNFG+fBgKHJJ+rGv+zbue90JepJ/MNLJdz4
N7jZidIW2qhM3aOeNLSakORHAk2F5jIc7nF1JaBJifYR+mW3mLgb4a6uaMPxmI4W
aLMCC1r/1RnwgIk7X4q6w1qBUORM7Qu6HgRSarV+HS8CHPsgyJo=
=ga0n
-----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmeHws4ACgkQYKtH/8kJ
UidM0Q/8DXa8sk6JnZl/3Di4LEICPQEf6y+fOEFtSM+xAVX76oPVYpnDHo3BLqX+
ehROGRYXWKJ2G5okmmAasWlNmbfi6WfrxzYLRwDyICD06grgkMHnmzA7exxgxrsY
+PdjPUSB1+9MfJYgJLQpuFuvpFr9QfFAZ42Tzm528BJhrDbzabS4UhCS/21GL44u
JzathnSrclhaq2gHUjxw97gU6schUYDk0v4m4T4rC8oVq/7xQpYlPDnJxjuoEI0X
GJ1pkyVUY31HFTLXL3YHTCXhRheZQ4/7UfVR7SqBjCIeqjIAglYnNplCLGg8oInK
IXF7fuP63CNJzadYTme8Xo8pTQmahRGk57YQ4Ev6MkEc3qOqMRXGhKCrtZkd2pAF
uD5+BGkSJU3+Ij/fjpdpy6L9F5mpftvpBGb91AHEy1TdoHeYfvAY96V0EcZVz3QB
e42FwRCoGX9olhql9cYV4iec1f8d8nV76f4SCmJtoyP86k3wIkks20gCTe3R5BZz
L76hk0cH5Gy5yq5nCaZZ97/J9ds1Q0djD4xULx9fuMRE7y0P9JFIzNcukn5P7a7f
scBwsMW92cDJ4b0l3SGtbT0znueKRPNk6xoMo1RiEbT5AEd/s76an3yxS3pVVd2/
6uQKfQQ2cIFEnquym12Eq4PqbAJaTpGaGsitCpNak7JMm9uBMfQ=
=ixTm
-----END PGP SIGNATURE-----
Merge tag 'scmi-updates-6.14' of https://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux into soc/drivers
Arm SCMI updates for 6.14
This mainly has 2 updates:
1. Extension of the transport properties read from devicetree to support
multiple SCMI platform/server instances
2. Addition of the capability to automatically load the proper SCMI vendor
protocol module. The vendor protocol selection is already provided by
the SCMI core while the automatic loading of vendor protocols was not.
* tag 'scmi-updates-6.14' of https://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux:
firmware: arm_scmi: Add aliases to transport modules
firmware: arm_scmi: Add module aliases to i.MX vendor protocols
firmware: arm_scmi: Support vendor protocol modules autoloading
firmware: arm_scmi: Allow transport properties for multiple instances
Link: https://lore.kernel.org/r/20250102154024.2168165-1-sudeep.holla@arm.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
commit
14ade5aa1a
|
|
@ -442,7 +442,7 @@ struct scmi_transport_core_operations {
|
|||
*/
|
||||
struct scmi_transport {
|
||||
struct device *supplier;
|
||||
struct scmi_desc *desc;
|
||||
struct scmi_desc desc;
|
||||
struct scmi_transport_core_operations **core_ops;
|
||||
};
|
||||
|
||||
|
|
@ -468,7 +468,7 @@ static int __tag##_probe(struct platform_device *pdev) \
|
|||
device_set_of_node_from_dev(&spdev->dev, dev); \
|
||||
\
|
||||
strans.supplier = dev; \
|
||||
strans.desc = &(__desc); \
|
||||
memcpy(&strans.desc, &(__desc), sizeof(strans.desc)); \
|
||||
strans.core_ops = &(__core_ops); \
|
||||
\
|
||||
ret = platform_device_add_data(spdev, &strans, sizeof(strans)); \
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include <linux/io.h>
|
||||
#include <linux/io-64-nonatomic-hi-lo.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/kmod.h>
|
||||
#include <linux/ktime.h>
|
||||
#include <linux/hashtable.h>
|
||||
#include <linux/list.h>
|
||||
|
|
@ -43,6 +44,8 @@
|
|||
#define CREATE_TRACE_POINTS
|
||||
#include <trace/events/scmi.h>
|
||||
|
||||
#define SCMI_VENDOR_MODULE_ALIAS_FMT "scmi-protocol-0x%02x-%s"
|
||||
|
||||
static DEFINE_IDA(scmi_id);
|
||||
|
||||
static DEFINE_XARRAY(scmi_protocols);
|
||||
|
|
@ -275,6 +278,44 @@ scmi_vendor_protocol_lookup(int protocol_id, char *vendor_id,
|
|||
return proto;
|
||||
}
|
||||
|
||||
static const struct scmi_protocol *
|
||||
scmi_vendor_protocol_get(int protocol_id, struct scmi_revision_info *version)
|
||||
{
|
||||
const struct scmi_protocol *proto;
|
||||
|
||||
proto = scmi_vendor_protocol_lookup(protocol_id, version->vendor_id,
|
||||
version->sub_vendor_id,
|
||||
version->impl_ver);
|
||||
if (!proto) {
|
||||
int ret;
|
||||
|
||||
pr_debug("Looking for '" SCMI_VENDOR_MODULE_ALIAS_FMT "'\n",
|
||||
protocol_id, version->vendor_id);
|
||||
|
||||
/* Note that vendor_id is mandatory for vendor protocols */
|
||||
ret = request_module(SCMI_VENDOR_MODULE_ALIAS_FMT,
|
||||
protocol_id, version->vendor_id);
|
||||
if (ret) {
|
||||
pr_warn("Problem loading module for protocol 0x%x\n",
|
||||
protocol_id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Lookup again, once modules loaded */
|
||||
proto = scmi_vendor_protocol_lookup(protocol_id,
|
||||
version->vendor_id,
|
||||
version->sub_vendor_id,
|
||||
version->impl_ver);
|
||||
}
|
||||
|
||||
if (proto)
|
||||
pr_info("Loaded SCMI Vendor Protocol 0x%x - %s %s %X\n",
|
||||
protocol_id, proto->vendor_id ?: "",
|
||||
proto->sub_vendor_id ?: "", proto->impl_ver);
|
||||
|
||||
return proto;
|
||||
}
|
||||
|
||||
static const struct scmi_protocol *
|
||||
scmi_protocol_get(int protocol_id, struct scmi_revision_info *version)
|
||||
{
|
||||
|
|
@ -283,10 +324,8 @@ scmi_protocol_get(int protocol_id, struct scmi_revision_info *version)
|
|||
if (protocol_id < SCMI_PROTOCOL_VENDOR_BASE)
|
||||
proto = xa_load(&scmi_protocols, protocol_id);
|
||||
else
|
||||
proto = scmi_vendor_protocol_lookup(protocol_id,
|
||||
version->vendor_id,
|
||||
version->sub_vendor_id,
|
||||
version->impl_ver);
|
||||
proto = scmi_vendor_protocol_get(protocol_id, version);
|
||||
|
||||
if (!proto || !try_module_get(proto->owner)) {
|
||||
pr_warn("SCMI Protocol 0x%x not found!\n", protocol_id);
|
||||
return NULL;
|
||||
|
|
@ -294,11 +333,6 @@ scmi_protocol_get(int protocol_id, struct scmi_revision_info *version)
|
|||
|
||||
pr_debug("Found SCMI Protocol 0x%x\n", protocol_id);
|
||||
|
||||
if (protocol_id >= SCMI_PROTOCOL_VENDOR_BASE)
|
||||
pr_info("Loaded SCMI Vendor Protocol 0x%x - %s %s %X\n",
|
||||
protocol_id, proto->vendor_id ?: "",
|
||||
proto->sub_vendor_id ?: "", proto->impl_ver);
|
||||
|
||||
return proto;
|
||||
}
|
||||
|
||||
|
|
@ -366,7 +400,9 @@ int scmi_protocol_register(const struct scmi_protocol *proto)
|
|||
return ret;
|
||||
}
|
||||
|
||||
pr_debug("Registered SCMI Protocol 0x%x\n", proto->id);
|
||||
pr_debug("Registered SCMI Protocol 0x%x - %s %s 0x%08X\n",
|
||||
proto->id, proto->vendor_id, proto->sub_vendor_id,
|
||||
proto->impl_ver);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -3028,7 +3064,7 @@ static const struct scmi_desc *scmi_transport_setup(struct device *dev)
|
|||
int ret;
|
||||
|
||||
trans = dev_get_platdata(dev);
|
||||
if (!trans || !trans->desc || !trans->supplier || !trans->core_ops)
|
||||
if (!trans || !trans->supplier || !trans->core_ops)
|
||||
return NULL;
|
||||
|
||||
if (!device_link_add(dev, trans->supplier, DL_FLAG_AUTOREMOVE_CONSUMER)) {
|
||||
|
|
@ -3043,33 +3079,33 @@ static const struct scmi_desc *scmi_transport_setup(struct device *dev)
|
|||
dev_info(dev, "Using %s\n", dev_driver_string(trans->supplier));
|
||||
|
||||
ret = of_property_read_u32(dev->of_node, "arm,max-rx-timeout-ms",
|
||||
&trans->desc->max_rx_timeout_ms);
|
||||
&trans->desc.max_rx_timeout_ms);
|
||||
if (ret && ret != -EINVAL)
|
||||
dev_err(dev, "Malformed arm,max-rx-timeout-ms DT property.\n");
|
||||
|
||||
ret = of_property_read_u32(dev->of_node, "arm,max-msg-size",
|
||||
&trans->desc->max_msg_size);
|
||||
&trans->desc.max_msg_size);
|
||||
if (ret && ret != -EINVAL)
|
||||
dev_err(dev, "Malformed arm,max-msg-size DT property.\n");
|
||||
|
||||
ret = of_property_read_u32(dev->of_node, "arm,max-msg",
|
||||
&trans->desc->max_msg);
|
||||
&trans->desc.max_msg);
|
||||
if (ret && ret != -EINVAL)
|
||||
dev_err(dev, "Malformed arm,max-msg DT property.\n");
|
||||
|
||||
dev_info(dev,
|
||||
"SCMI max-rx-timeout: %dms / max-msg-size: %dbytes / max-msg: %d\n",
|
||||
trans->desc->max_rx_timeout_ms, trans->desc->max_msg_size,
|
||||
trans->desc->max_msg);
|
||||
trans->desc.max_rx_timeout_ms, trans->desc.max_msg_size,
|
||||
trans->desc.max_msg);
|
||||
|
||||
/* System wide atomic threshold for atomic ops .. if any */
|
||||
if (!of_property_read_u32(dev->of_node, "atomic-threshold-us",
|
||||
&trans->desc->atomic_threshold))
|
||||
&trans->desc.atomic_threshold))
|
||||
dev_info(dev,
|
||||
"SCMI System wide atomic threshold set to %u us\n",
|
||||
trans->desc->atomic_threshold);
|
||||
trans->desc.atomic_threshold);
|
||||
|
||||
return trans->desc;
|
||||
return &trans->desc;
|
||||
}
|
||||
|
||||
static int scmi_probe(struct platform_device *pdev)
|
||||
|
|
|
|||
|
|
@ -378,6 +378,7 @@ static const struct of_device_id scmi_of_match[] = {
|
|||
{ .compatible = "arm,scmi" },
|
||||
{ /* Sentinel */ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, scmi_of_match);
|
||||
|
||||
DEFINE_SCMI_TRANSPORT_DRIVER(scmi_mailbox, scmi_mailbox_driver,
|
||||
scmi_mailbox_desc, scmi_of_match, core);
|
||||
|
|
|
|||
|
|
@ -301,6 +301,7 @@ static const struct of_device_id scmi_of_match[] = {
|
|||
{ .compatible = "qcom,scmi-smc" },
|
||||
{ /* Sentinel */ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, scmi_of_match);
|
||||
|
||||
DEFINE_SCMI_TRANSPORT_DRIVER(scmi_smc, scmi_smc_driver, scmi_smc_desc,
|
||||
scmi_of_match, core);
|
||||
|
|
|
|||
|
|
@ -921,6 +921,7 @@ static const struct virtio_device_id id_table[] = {
|
|||
{ VIRTIO_ID_SCMI, VIRTIO_DEV_ANY_ID },
|
||||
{ 0 }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(virtio, id_table);
|
||||
|
||||
static struct virtio_driver virtio_scmi_driver = {
|
||||
.driver.name = "scmi-virtio",
|
||||
|
|
|
|||
|
|
@ -374,10 +374,11 @@ static const struct scmi_protocol scmi_imx_bbm = {
|
|||
.ops = &scmi_imx_bbm_proto_ops,
|
||||
.events = &scmi_imx_bbm_protocol_events,
|
||||
.supported_version = SCMI_PROTOCOL_SUPPORTED_VERSION,
|
||||
.vendor_id = "NXP",
|
||||
.sub_vendor_id = "IMX",
|
||||
.vendor_id = SCMI_IMX_VENDOR,
|
||||
.sub_vendor_id = SCMI_IMX_SUBVENDOR,
|
||||
};
|
||||
module_scmi_protocol(scmi_imx_bbm);
|
||||
|
||||
MODULE_ALIAS("scmi-protocol-" __stringify(SCMI_PROTOCOL_IMX_BBM) "-" SCMI_IMX_VENDOR);
|
||||
MODULE_DESCRIPTION("i.MX SCMI BBM driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -309,10 +309,11 @@ static const struct scmi_protocol scmi_imx_misc = {
|
|||
.ops = &scmi_imx_misc_proto_ops,
|
||||
.events = &scmi_imx_misc_protocol_events,
|
||||
.supported_version = SCMI_PROTOCOL_SUPPORTED_VERSION,
|
||||
.vendor_id = "NXP",
|
||||
.sub_vendor_id = "IMX",
|
||||
.vendor_id = SCMI_IMX_VENDOR,
|
||||
.sub_vendor_id = SCMI_IMX_SUBVENDOR,
|
||||
};
|
||||
module_scmi_protocol(scmi_imx_misc);
|
||||
|
||||
MODULE_ALIAS("scmi-protocol-" __stringify(SCMI_PROTOCOL_IMX_MISC) "-" SCMI_IMX_VENDOR);
|
||||
MODULE_DESCRIPTION("i.MX SCMI MISC driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -13,10 +13,11 @@
|
|||
#include <linux/notifier.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
enum scmi_nxp_protocol {
|
||||
SCMI_PROTOCOL_IMX_BBM = 0x81,
|
||||
SCMI_PROTOCOL_IMX_MISC = 0x84,
|
||||
};
|
||||
#define SCMI_PROTOCOL_IMX_BBM 0x81
|
||||
#define SCMI_PROTOCOL_IMX_MISC 0x84
|
||||
|
||||
#define SCMI_IMX_VENDOR "NXP"
|
||||
#define SCMI_IMX_SUBVENDOR "IMX"
|
||||
|
||||
struct scmi_imx_bbm_proto_ops {
|
||||
int (*rtc_time_set)(const struct scmi_protocol_handle *ph, u32 id,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user