11
11
#include <linux/module.h>
12
12
#include <linux/of_device.h>
13
13
#include <linux/platform_device.h>
14
+ #include <linux/sys_soc.h>
14
15
#include <linux/property.h>
15
16
#include <linux/regmap.h>
16
17
#include <linux/rtc.h>
45
46
#define K3RTC_MIN_OFFSET (-277761)
46
47
#define K3RTC_MAX_OFFSET (277778)
47
48
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
-
56
49
static const struct regmap_config ti_k3_rtc_regmap_config = {
57
50
.name = "peripheral-registers" ,
58
51
.reg_bits = 32 ,
@@ -118,7 +111,6 @@ static const struct reg_field ti_rtc_reg_fields[] = {
118
111
* @rtc_dev: rtc device
119
112
* @regmap: rtc mmio regmap
120
113
* @r_fields: rtc register fields
121
- * @soc: SoC compatible match data
122
114
*/
123
115
struct ti_k3_rtc {
124
116
unsigned int irq ;
@@ -127,7 +119,6 @@ struct ti_k3_rtc {
127
119
struct rtc_device * rtc_dev ;
128
120
struct regmap * regmap ;
129
121
struct regmap_field * r_fields [K3_RTC_MAX_FIELDS ];
130
- const struct ti_k3_rtc_soc_data * soc ;
131
122
};
132
123
133
124
static 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)
195
186
return ret ;
196
187
}
197
188
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
+
198
200
static int k3rtc_configure (struct device * dev )
199
201
{
200
202
int ret ;
@@ -208,7 +210,7 @@ static int k3rtc_configure(struct device *dev)
208
210
*
209
211
* In such occurrence, it is assumed that the RTC module is unusable
210
212
*/
211
- if (priv -> soc -> unlock_irq_erratum ) {
213
+ if (soc_device_match ( has_erratum_i2327 ) ) {
212
214
ret = k3rtc_check_unlocked (priv );
213
215
/* If there is an error OR if we are locked, return error */
214
216
if (ret ) {
@@ -602,8 +604,6 @@ static int ti_k3_rtc_probe(struct platform_device *pdev)
602
604
if (IS_ERR (priv -> rtc_dev ))
603
605
return PTR_ERR (priv -> rtc_dev );
604
606
605
- priv -> soc = of_device_get_match_data (dev );
606
-
607
607
priv -> rtc_dev -> ops = & ti_k3_rtc_ops ;
608
608
priv -> rtc_dev -> range_max = (1ULL << 48 ) - 1 ; /* 48Bit seconds */
609
609
ti_k3_rtc_nvmem_config .priv = priv ;
@@ -635,12 +635,8 @@ static int ti_k3_rtc_probe(struct platform_device *pdev)
635
635
return devm_rtc_nvmem_register (priv -> rtc_dev , & ti_k3_rtc_nvmem_config );
636
636
}
637
637
638
- static const struct ti_k3_rtc_soc_data ti_k3_am62_data = {
639
- .unlock_irq_erratum = true,
640
- };
641
-
642
638
static 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" },
644
640
{}
645
641
};
646
642
MODULE_DEVICE_TABLE (of , ti_k3_rtc_of_match_table );
0 commit comments