30
30
#define TMR_DISABLE 0x0
31
31
#define TMR_ME 0x80000000
32
32
#define TMR_ALPF 0x0c000000
33
+ #define TMR_MSITE_ALL GENMASK(15, 0)
33
34
34
35
#define REGS_TMTMIR 0x008 /* Temperature measurement interval Register */
35
36
#define TMTMIR_DEFAULT 0x0000000f
@@ -94,7 +95,15 @@ static const struct thermal_zone_of_device_ops tmu_tz_ops = {
94
95
static int qoriq_tmu_register_tmu_zone (struct device * dev ,
95
96
struct qoriq_tmu_data * qdata )
96
97
{
97
- int id , sites = 0 ;
98
+ int id ;
99
+
100
+ if (qdata -> ver == TMU_VER1 ) {
101
+ regmap_write (qdata -> regmap , REGS_TMR ,
102
+ TMR_MSITE_ALL | TMR_ME | TMR_ALPF );
103
+ } else {
104
+ regmap_write (qdata -> regmap , REGS_V2_TMSR , TMR_MSITE_ALL );
105
+ regmap_write (qdata -> regmap , REGS_TMR , TMR_ME | TMR_ALPF_V2 );
106
+ }
98
107
99
108
for (id = 0 ; id < SITES_MAX ; id ++ ) {
100
109
struct thermal_zone_device * tzd ;
@@ -110,25 +119,9 @@ static int qoriq_tmu_register_tmu_zone(struct device *dev,
110
119
if (ret ) {
111
120
if (ret == - ENODEV )
112
121
continue ;
113
- else
114
- return ret ;
115
- }
116
122
117
- if (qdata -> ver == TMU_VER1 )
118
- sites |= 0x1 << (15 - id );
119
- else
120
- sites |= 0x1 << id ;
121
- }
122
-
123
- /* Enable monitoring */
124
- if (sites != 0 ) {
125
- if (qdata -> ver == TMU_VER1 ) {
126
- regmap_write (qdata -> regmap , REGS_TMR ,
127
- sites | TMR_ME | TMR_ALPF );
128
- } else {
129
- regmap_write (qdata -> regmap , REGS_V2_TMSR , sites );
130
- regmap_write (qdata -> regmap , REGS_TMR ,
131
- TMR_ME | TMR_ALPF_V2 );
123
+ regmap_write (qdata -> regmap , REGS_TMR , TMR_DISABLE );
124
+ return ret ;
132
125
}
133
126
}
134
127
0 commit comments