]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
i3c: master: svc: Add support for Nuvoton npcm845 i3c
authorStanley Chu <yschu@nuvoton.com>
Thu, 6 Mar 2025 07:54:26 +0000 (15:54 +0800)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Thu, 6 Mar 2025 20:51:22 +0000 (21:51 +0100)
Nuvoton npcm845 SoC uses an older IP version, which has specific
hardware issues that need to be addressed with a different compatible
string.

Add driver data for different compatible strings to define platform
specific quirks.
Add compatible string for npcm845 to define its own driver data.

Signed-off-by: Stanley Chu <yschu@nuvoton.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20250306075429.2265183-3-yschu@nuvoton.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/i3c/master/svc-i3c-master.c

index 98f800f999691438dfcf7f156d3815bca8a383a6..c0299e3f2cf85307bbfd1229f1a5915bd76a9520 100644 (file)
@@ -158,6 +158,10 @@ struct svc_i3c_regs_save {
        u32 mdynaddr;
 };
 
+struct svc_i3c_drvdata {
+       u32 quirks;
+};
+
 /**
  * struct svc_i3c_master - Silvaco I3C Master structure
  * @base: I3C master controller
@@ -183,6 +187,7 @@ struct svc_i3c_regs_save {
  * @ibi.tbq_slot: To be queued IBI slot
  * @ibi.lock: IBI lock
  * @lock: Transfer lock, protect between IBI work thread and callbacks from master
+ * @drvdata: Driver data
  * @enabled_events: Bit masks for enable events (IBI, HotJoin).
  * @mctrl_config: Configuration value in SVC_I3C_MCTRL for setting speed back.
  */
@@ -214,6 +219,7 @@ struct svc_i3c_master {
                spinlock_t lock;
        } ibi;
        struct mutex lock;
+       const struct svc_i3c_drvdata *drvdata;
        u32 enabled_events;
        u32 mctrl_config;
 };
@@ -1819,6 +1825,10 @@ static int svc_i3c_master_probe(struct platform_device *pdev)
        if (!master)
                return -ENOMEM;
 
+       master->drvdata = of_device_get_match_data(dev);
+       if (!master->drvdata)
+               return -EINVAL;
+
        master->regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(master->regs))
                return PTR_ERR(master->regs);
@@ -1960,8 +1970,13 @@ static const struct dev_pm_ops svc_i3c_pm_ops = {
                           svc_i3c_runtime_resume, NULL)
 };
 
+static const struct svc_i3c_drvdata npcm845_drvdata = {};
+
+static const struct svc_i3c_drvdata svc_default_drvdata = {};
+
 static const struct of_device_id svc_i3c_master_of_match_tbl[] = {
-       { .compatible = "silvaco,i3c-master-v1"},
+       { .compatible = "nuvoton,npcm845-i3c", .data = &npcm845_drvdata },
+       { .compatible = "silvaco,i3c-master-v1", .data = &svc_default_drvdata },
        { /* sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, svc_i3c_master_of_match_tbl);