Skip to content

Commit 98d8760

Browse files
stanleychuysalexandrebelloni
authored andcommitted
i3c: master: svc: Add support for Nuvoton npcm845 i3c
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 <[email protected]> Reviewed-by: Frank Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent c24a084 commit 98d8760

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

drivers/i3c/master/svc-i3c-master.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ struct svc_i3c_regs_save {
158158
u32 mdynaddr;
159159
};
160160

161+
struct svc_i3c_drvdata {
162+
u32 quirks;
163+
};
164+
161165
/**
162166
* struct svc_i3c_master - Silvaco I3C Master structure
163167
* @base: I3C master controller
@@ -183,6 +187,7 @@ struct svc_i3c_regs_save {
183187
* @ibi.tbq_slot: To be queued IBI slot
184188
* @ibi.lock: IBI lock
185189
* @lock: Transfer lock, protect between IBI work thread and callbacks from master
190+
* @drvdata: Driver data
186191
* @enabled_events: Bit masks for enable events (IBI, HotJoin).
187192
* @mctrl_config: Configuration value in SVC_I3C_MCTRL for setting speed back.
188193
*/
@@ -214,6 +219,7 @@ struct svc_i3c_master {
214219
spinlock_t lock;
215220
} ibi;
216221
struct mutex lock;
222+
const struct svc_i3c_drvdata *drvdata;
217223
u32 enabled_events;
218224
u32 mctrl_config;
219225
};
@@ -1819,6 +1825,10 @@ static int svc_i3c_master_probe(struct platform_device *pdev)
18191825
if (!master)
18201826
return -ENOMEM;
18211827

1828+
master->drvdata = of_device_get_match_data(dev);
1829+
if (!master->drvdata)
1830+
return -EINVAL;
1831+
18221832
master->regs = devm_platform_ioremap_resource(pdev, 0);
18231833
if (IS_ERR(master->regs))
18241834
return PTR_ERR(master->regs);
@@ -1960,8 +1970,13 @@ static const struct dev_pm_ops svc_i3c_pm_ops = {
19601970
svc_i3c_runtime_resume, NULL)
19611971
};
19621972

1973+
static const struct svc_i3c_drvdata npcm845_drvdata = {};
1974+
1975+
static const struct svc_i3c_drvdata svc_default_drvdata = {};
1976+
19631977
static const struct of_device_id svc_i3c_master_of_match_tbl[] = {
1964-
{ .compatible = "silvaco,i3c-master-v1"},
1978+
{ .compatible = "nuvoton,npcm845-i3c", .data = &npcm845_drvdata },
1979+
{ .compatible = "silvaco,i3c-master-v1", .data = &svc_default_drvdata },
19651980
{ /* sentinel */ },
19661981
};
19671982
MODULE_DEVICE_TABLE(of, svc_i3c_master_of_match_tbl);

0 commit comments

Comments
 (0)