]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
firmware: scmi: fix the multi channel support with CCF
authorPatrick Delaunay <patrick.delaunay@foss.st.com>
Fri, 30 Sep 2022 07:36:38 +0000 (09:36 +0200)
committerTom Rini <trini@konsulko.com>
Wed, 12 Oct 2022 12:55:31 +0000 (08:55 -0400)
When the CCF is activated, the dev->parent is not necessary
the reference to SCMI transport and the function devm_scmi_of_get_channel
failed for the registered SCMI clock, child for protocol@14,
the channel is null and the SCMI clock driver crash for any operations.

This patch changes the first parameter of the ops of_get_channel(),
aligned with other process_msg() to pass directly the good reference,
i.e. parent result of find_scmi_transport_device(dev)
which return the reference of the scmi transport device.

Fixes: 8e96801aa6a ("firmware: scmi: add multi-channel support")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
drivers/firmware/scmi/mailbox_agent.c
drivers/firmware/scmi/optee_agent.c
drivers/firmware/scmi/scmi_agent-uclass.c
drivers/firmware/scmi/smccc_agent.c

index 3efdab9e723bdb0226a3192228ee98332b67370a..8277c186060666622415bf691b324e47b57edd4c 100644 (file)
@@ -96,7 +96,7 @@ static int setup_channel(struct udevice *dev, struct scmi_mbox_channel *chan)
 static int scmi_mbox_get_channel(struct udevice *dev,
                                 struct scmi_channel **channel)
 {
-       struct scmi_mbox_channel *base_chan = dev_get_plat(dev->parent);
+       struct scmi_mbox_channel *base_chan = dev_get_plat(dev);
        struct scmi_mbox_channel *chan;
        int ret;
 
index 2b2b8c1670a355b737dd76fe2c145d11e72f89fa..db927fb21405725b2129bae69292267c3414908a 100644 (file)
@@ -326,7 +326,7 @@ static int setup_channel(struct udevice *dev, struct scmi_optee_channel *chan)
 static int scmi_optee_get_channel(struct udevice *dev,
                                  struct scmi_channel **channel)
 {
-       struct scmi_optee_channel *base_chan = dev_get_plat(dev->parent);
+       struct scmi_optee_channel *base_chan = dev_get_plat(dev);
        struct scmi_optee_channel *chan;
        u32 channel_id;
        int ret;
index c3f3d1f44007c1e4396a1d4ebd8e91ef4abb08a6..8f48de30c8cc0d4e3ca4287064ed7fb0bfddd01d 100644 (file)
@@ -137,7 +137,7 @@ int devm_scmi_of_get_channel(struct udevice *dev, struct scmi_channel **channel)
                return -ENODEV;
 
        if (transport_dev_ops(parent)->of_get_channel)
-               return transport_dev_ops(parent)->of_get_channel(dev, channel);
+               return transport_dev_ops(parent)->of_get_channel(parent, channel);
 
        /* Drivers without a get_channel operator don't need a channel ref */
        *channel = NULL;
index bc2eb67335b9764978800cf3f59f11aa676a835c..6a52cd75d67bec48c264555a19bec872bb3a740d 100644 (file)
@@ -83,7 +83,7 @@ static int setup_channel(struct udevice *dev, struct scmi_smccc_channel *chan)
 static int scmi_smccc_get_channel(struct udevice *dev,
                                  struct scmi_channel **channel)
 {
-       struct scmi_smccc_channel *base_chan = dev_get_plat(dev->parent);
+       struct scmi_smccc_channel *base_chan = dev_get_plat(dev);
        struct scmi_smccc_channel *chan;
        u32 func_id;
        int ret;