]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
firmware: scmi: add a version check against base protocol
authorAKASHI Takahiro <takahiro.akashi@linaro.org>
Wed, 11 Oct 2023 10:07:01 +0000 (19:07 +0900)
committerTom Rini <trini@konsulko.com>
Fri, 13 Oct 2023 20:59:23 +0000 (16:59 -0400)
In SCMI base protocol version 2 (0x20000), new interfaces,
BASE_SET_DEVICE_PERMISSIONS/BASE_SET_PROTOCOL_PERMISSIONS/
BASE_RESET_AGENT_CONFIGURATION, were added. Moreover, the api of
BASE_DISCOVER_AGENT was changed to support self-agent discovery.

So the driver expects SCMI firmware support version 2 of base protocol.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
drivers/firmware/scmi/base.c

index ee84e261945a6a25dabb60e9b2b85b948b2de116..1d41a8a98fc61b113f255e233589fea28d4f2b85 100644 (file)
@@ -481,6 +481,7 @@ static int scmi_base_reset_agent_configuration_int(struct udevice *dev,
  */
 static int scmi_base_probe(struct udevice *dev)
 {
+       u32 version;
        int ret;
 
        ret = devm_scmi_of_get_channel(dev);
@@ -488,6 +489,13 @@ static int scmi_base_probe(struct udevice *dev)
                dev_err(dev, "get_channel failed\n");
                return ret;
        }
+       ret = scmi_base_protocol_version_int(dev, &version);
+       if (ret) {
+               dev_err(dev, "getting protocol version failed\n");
+               return ret;
+       }
+       if (version < SCMI_BASE_PROTOCOL_VERSION)
+               return -EINVAL;
 
        return ret;
 }