]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
soc: microchip: mpfs-sys-controller: add support for pic64gx
authorPierre-Henry Moussay <pierre-henry.moussay@microchip.com>
Mon, 17 Nov 2025 14:21:22 +0000 (14:21 +0000)
committerConor Dooley <conor.dooley@microchip.com>
Tue, 3 Mar 2026 17:08:41 +0000 (17:08 +0000)
pic64gx is not compatible with mpfs because due to the lack of FPGA
functionality some features are disabled. Notably, anything to do with
FPGA fabric contents is not supported.

Signed-off-by: Pierre-Henry Moussay <pierre-henry.moussay@microchip.com>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
drivers/soc/microchip/mpfs-sys-controller.c

index 8e7ae3cb92fff9b25e2f68170ac3ad55cceacfe3..0be7b109df05941dd9d7ea4cdfb519f6a1d849af 100644 (file)
@@ -36,6 +36,11 @@ struct mpfs_sys_controller {
        struct kref consumers;
 };
 
+struct mpfs_syscon_config {
+       unsigned int nb_subdevs;
+       struct platform_device *subdevs;
+};
+
 int mpfs_blocking_transaction(struct mpfs_sys_controller *sys_controller, struct mpfs_mss_msg *msg)
 {
        unsigned long timeout = msecs_to_jiffies(MPFS_SYS_CTRL_TIMEOUT_MS);
@@ -110,25 +115,11 @@ struct mtd_info *mpfs_sys_controller_get_flash(struct mpfs_sys_controller *mpfs_
 }
 EXPORT_SYMBOL(mpfs_sys_controller_get_flash);
 
-static struct platform_device subdevs[] = {
-       {
-               .name           = "mpfs-rng",
-               .id             = -1,
-       },
-       {
-               .name           = "mpfs-generic-service",
-               .id             = -1,
-       },
-       {
-               .name           = "mpfs-auto-update",
-               .id             = -1,
-       },
-};
-
 static int mpfs_sys_controller_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        struct mpfs_sys_controller *sys_controller;
+       struct mpfs_syscon_config *of_data;
        struct device_node *np;
        int i, ret;
 
@@ -164,11 +155,17 @@ no_flash:
 
        platform_set_drvdata(pdev, sys_controller);
 
+       of_data = (struct mpfs_syscon_config *) device_get_match_data(dev);
+       if (!of_data) {
+               dev_err(dev, "Error getting match data\n");
+               return -EINVAL;
+       }
 
-       for (i = 0; i < ARRAY_SIZE(subdevs); i++) {
-               subdevs[i].dev.parent = dev;
-               if (platform_device_register(&subdevs[i]))
-                       dev_warn(dev, "Error registering sub device %s\n", subdevs[i].name);
+       for (i = 0; i < of_data->nb_subdevs; i++) {
+               of_data->subdevs[i].dev.parent = dev;
+               if (platform_device_register(&of_data->subdevs[i]))
+                       dev_warn(dev, "Error registering sub device %s\n",
+                                of_data->subdevs[i].name);
        }
 
        dev_info(&pdev->dev, "Registered MPFS system controller\n");
@@ -183,8 +180,45 @@ static void mpfs_sys_controller_remove(struct platform_device *pdev)
        mpfs_sys_controller_put(sys_controller);
 }
 
+static struct platform_device mpfs_subdevs[] = {
+       {
+               .name           = "mpfs-rng",
+               .id             = -1,
+       },
+       {
+               .name           = "mpfs-generic-service",
+               .id             = -1,
+       },
+       {
+               .name           = "mpfs-auto-update",
+               .id             = -1,
+       },
+};
+
+static struct platform_device pic64gx_subdevs[] = {
+       {
+               .name           = "mpfs-rng",
+               .id             = -1,
+       },
+       {
+               .name           = "mpfs-generic-service",
+               .id             = -1,
+       },
+};
+
+static const struct mpfs_syscon_config mpfs_config = {
+       .nb_subdevs = ARRAY_SIZE(mpfs_subdevs),
+       .subdevs = mpfs_subdevs,
+};
+
+static const struct mpfs_syscon_config pic64gx_config = {
+       .nb_subdevs = ARRAY_SIZE(pic64gx_subdevs),
+       .subdevs = pic64gx_subdevs,
+};
+
 static const struct of_device_id mpfs_sys_controller_of_match[] = {
-       {.compatible = "microchip,mpfs-sys-controller", },
+       {.compatible = "microchip,mpfs-sys-controller", .data = &mpfs_config},
+       {.compatible = "microchip,pic64gx-sys-controller", .data = &pic64gx_config},
        {},
 };
 MODULE_DEVICE_TABLE(of, mpfs_sys_controller_of_match);