Re: [PATCH 2/2] rtc: Introduce ti-k3-rtc

From: Andrew Davis
Date: Wed Apr 13 2022 - 20:46:16 EST


On 4/12/22 2:31 AM, Nishanth Menon wrote:
[...]

+
+static inline u32 k3rtc_readl(struct ti_k3_rtc *priv, u32 offset)
+{
+ return readl(priv->rtc_base + offset);


Could we use regmap in this driver?

[...]


+
+ reg = k3rtc_readl(priv, REG_K3RTC_IRQENABLE_SET_SYS);
+ reg &= K3RTC_EVENT_ON_OFF_BIT;


regmap fields to get rid of all the bitmasking

[...]



+ return 0;
+
+ k3rtc_writel(priv, offset, K3RTC_EVENT_ON_OFF_BIT);
+
+ for (i = 0; i < bytes / 4; i++) {
+ val[i] = k3rtc_readl(priv,
+ REG_K3RTC_SCRATCH0 + offset + (i * 4));
+ }
+


regmap_bulk_read()

[...]


+
+ priv->rtc_base = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(priv->rtc_base))
+ return PTR_ERR(priv->rtc_base);
+


devm_regmap_init_mmio(dev, priv->rtc_base, ...)

[...]


+static struct platform_driver ti_k3_rtc_driver = {
+ .probe = ti_k3_rtc_probe,
+ .driver = {
+ .name = "rtc-ti-k3",
+ .of_match_table = ti_k3_rtc_of_match_table,
+ .pm = &ti_k3_rtc_pm_ops,
+ },
+};
+module_platform_driver(ti_k3_rtc_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("TI K3 RTC driver");
+MODULE_AUTHOR("Nishanth Menon");
+MODULE_ALIAS("platform:rtc-ti-k3");


Is MODULE_ALIAS needed here? The MODULE_DEVICE_TABLE above will
build the MOD ALIAS table needed for OF loading.

Andrew