1111#include <linux/module.h>
1212#include <linux/of_device.h>
1313#include <linux/platform_device.h>
14+ #include <linux/sys_soc.h>
1415#include <linux/property.h>
1516#include <linux/regmap.h>
1617#include <linux/rtc.h>
4546#define K3RTC_MIN_OFFSET (-277761)
4647#define K3RTC_MAX_OFFSET (277778)
4748
48- /**
49- * struct ti_k3_rtc_soc_data - Private of compatible data for ti-k3-rtc
50- * @unlock_irq_erratum: Has erratum for unlock infinite IRQs (erratum i2327)
51- */
52- struct ti_k3_rtc_soc_data {
53- const bool unlock_irq_erratum ;
54- };
55-
5649static const struct regmap_config ti_k3_rtc_regmap_config = {
5750 .name = "peripheral-registers" ,
5851 .reg_bits = 32 ,
@@ -118,7 +111,6 @@ static const struct reg_field ti_rtc_reg_fields[] = {
118111 * @rtc_dev: rtc device
119112 * @regmap: rtc mmio regmap
120113 * @r_fields: rtc register fields
121- * @soc: SoC compatible match data
122114 */
123115struct ti_k3_rtc {
124116 unsigned int irq ;
@@ -127,7 +119,6 @@ struct ti_k3_rtc {
127119 struct rtc_device * rtc_dev ;
128120 struct regmap * regmap ;
129121 struct regmap_field * r_fields [K3_RTC_MAX_FIELDS ];
130- const struct ti_k3_rtc_soc_data * soc ;
131122};
132123
133124static int k3rtc_field_read (struct ti_k3_rtc * priv , enum ti_k3_rtc_fields f )
@@ -195,6 +186,17 @@ static int k3rtc_unlock_rtc(struct ti_k3_rtc *priv)
195186 return ret ;
196187}
197188
189+ /*
190+ * This is the list of SoCs affected by TI's i2327 errata causing the RTC
191+ * state-machine to break if not unlocked fast enough during boot. These
192+ * SoCs must have the bootloader unlock this device very early in the
193+ * boot-flow before we (Linux) can use this device.
194+ */
195+ static const struct soc_device_attribute has_erratum_i2327 [] = {
196+ { .family = "AM62X" , .revision = "SR1.0" },
197+ { /* sentinel */ }
198+ };
199+
198200static int k3rtc_configure (struct device * dev )
199201{
200202 int ret ;
@@ -208,7 +210,7 @@ static int k3rtc_configure(struct device *dev)
208210 *
209211 * In such occurrence, it is assumed that the RTC module is unusable
210212 */
211- if (priv -> soc -> unlock_irq_erratum ) {
213+ if (soc_device_match ( has_erratum_i2327 ) ) {
212214 ret = k3rtc_check_unlocked (priv );
213215 /* If there is an error OR if we are locked, return error */
214216 if (ret ) {
@@ -602,8 +604,6 @@ static int ti_k3_rtc_probe(struct platform_device *pdev)
602604 if (IS_ERR (priv -> rtc_dev ))
603605 return PTR_ERR (priv -> rtc_dev );
604606
605- priv -> soc = of_device_get_match_data (dev );
606-
607607 priv -> rtc_dev -> ops = & ti_k3_rtc_ops ;
608608 priv -> rtc_dev -> range_max = (1ULL << 48 ) - 1 ; /* 48Bit seconds */
609609 ti_k3_rtc_nvmem_config .priv = priv ;
@@ -635,12 +635,8 @@ static int ti_k3_rtc_probe(struct platform_device *pdev)
635635 return devm_rtc_nvmem_register (priv -> rtc_dev , & ti_k3_rtc_nvmem_config );
636636}
637637
638- static const struct ti_k3_rtc_soc_data ti_k3_am62_data = {
639- .unlock_irq_erratum = true,
640- };
641-
642638static const struct of_device_id ti_k3_rtc_of_match_table [] = {
643- {.compatible = "ti,am62-rtc" , . data = & ti_k3_am62_data },
639+ {.compatible = "ti,am62-rtc" },
644640 {}
645641};
646642MODULE_DEVICE_TABLE (of , ti_k3_rtc_of_match_table );
0 commit comments