diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/thermal/ti-soc-thermal/dra752-thermal-data.c | 3 | ||||
| -rw-r--r-- | drivers/thermal/ti-soc-thermal/ti-bandgap.c | 37 | ||||
| -rw-r--r-- | drivers/thermal/ti-soc-thermal/ti-bandgap.h | 4 |
3 files changed, 42 insertions, 2 deletions
diff --git a/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c b/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c index a4929272074f..58b5c6694cd4 100644 --- a/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c +++ b/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c | |||
| @@ -420,7 +420,8 @@ const struct ti_bandgap_data dra752_data = { | |||
| 420 | TI_BANDGAP_FEATURE_FREEZE_BIT | | 420 | TI_BANDGAP_FEATURE_FREEZE_BIT | |
| 421 | TI_BANDGAP_FEATURE_TALERT | | 421 | TI_BANDGAP_FEATURE_TALERT | |
| 422 | TI_BANDGAP_FEATURE_COUNTER_DELAY | | 422 | TI_BANDGAP_FEATURE_COUNTER_DELAY | |
| 423 | TI_BANDGAP_FEATURE_HISTORY_BUFFER, | 423 | TI_BANDGAP_FEATURE_HISTORY_BUFFER | |
| 424 | TI_BANDGAP_FEATURE_ERRATA_814, | ||
| 424 | .fclock_name = "l3instr_ts_gclk_div", | 425 | .fclock_name = "l3instr_ts_gclk_div", |
| 425 | .div_ck_name = "l3instr_ts_gclk_div", | 426 | .div_ck_name = "l3instr_ts_gclk_div", |
| 426 | .conv_table = dra752_adc_to_temp, | 427 | .conv_table = dra752_adc_to_temp, |
diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c index 62a5d449c388..9747523858a1 100644 --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c | |||
| @@ -119,6 +119,37 @@ exit: | |||
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | /** | 121 | /** |
| 122 | * ti_errata814_bandgap_read_temp() - helper function to read dra7 sensor temperature | ||
| 123 | * @bgp: pointer to ti_bandgap structure | ||
| 124 | * @reg: desired register (offset) to be read | ||
| 125 | * | ||
| 126 | * Function to read dra7 bandgap sensor temperature. This is done separately | ||
| 127 | * so as to workaround the errata "Bandgap Temperature read Dtemp can be | ||
| 128 | * corrupted" - Errata ID: i814". | ||
| 129 | * Read accesses to registers listed below can be corrupted due to incorrect | ||
| 130 | * resynchronization between clock domains. | ||
| 131 | * Read access to registers below can be corrupted : | ||
| 132 | * CTRL_CORE_DTEMP_MPU/GPU/CORE/DSPEVE/IVA_n (n = 0 to 4) | ||
| 133 | * CTRL_CORE_TEMP_SENSOR_MPU/GPU/CORE/DSPEVE/IVA_n | ||
| 134 | * | ||
| 135 | * Return: the register value. | ||
| 136 | */ | ||
| 137 | static u32 ti_errata814_bandgap_read_temp(struct ti_bandgap *bgp, u32 reg) | ||
| 138 | { | ||
| 139 | u32 val1, val2; | ||
| 140 | |||
| 141 | val1 = ti_bandgap_readl(bgp, reg); | ||
| 142 | val2 = ti_bandgap_readl(bgp, reg); | ||
| 143 | |||
| 144 | /* If both times we read the same value then that is right */ | ||
| 145 | if (val1 == val2) | ||
| 146 | return val1; | ||
| 147 | |||
| 148 | /* if val1 and val2 are different read it third time */ | ||
| 149 | return ti_bandgap_readl(bgp, reg); | ||
| 150 | } | ||
| 151 | |||
| 152 | /** | ||
| 122 | * ti_bandgap_read_temp() - helper function to read sensor temperature | 153 | * ti_bandgap_read_temp() - helper function to read sensor temperature |
| 123 | * @bgp: pointer to ti_bandgap structure | 154 | * @bgp: pointer to ti_bandgap structure |
| 124 | * @id: bandgap sensor id | 155 | * @id: bandgap sensor id |
| @@ -148,7 +179,11 @@ static u32 ti_bandgap_read_temp(struct ti_bandgap *bgp, int id) | |||
| 148 | } | 179 | } |
| 149 | 180 | ||
| 150 | /* read temperature */ | 181 | /* read temperature */ |
| 151 | temp = ti_bandgap_readl(bgp, reg); | 182 | if (TI_BANDGAP_HAS(bgp, ERRATA_814)) |
| 183 | temp = ti_errata814_bandgap_read_temp(bgp, reg); | ||
| 184 | else | ||
| 185 | temp = ti_bandgap_readl(bgp, reg); | ||
| 186 | |||
| 152 | temp &= tsr->bgap_dtemp_mask; | 187 | temp &= tsr->bgap_dtemp_mask; |
| 153 | 188 | ||
| 154 | if (TI_BANDGAP_HAS(bgp, FREEZE_BIT)) | 189 | if (TI_BANDGAP_HAS(bgp, FREEZE_BIT)) |
diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.h b/drivers/thermal/ti-soc-thermal/ti-bandgap.h index b3adf72f252d..b2da3fc42b51 100644 --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.h +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.h | |||
| @@ -318,6 +318,9 @@ struct ti_temp_sensor { | |||
| 318 | * TI_BANDGAP_FEATURE_HISTORY_BUFFER - used when the bandgap device features | 318 | * TI_BANDGAP_FEATURE_HISTORY_BUFFER - used when the bandgap device features |
| 319 | * a history buffer of temperatures. | 319 | * a history buffer of temperatures. |
| 320 | * | 320 | * |
| 321 | * TI_BANDGAP_FEATURE_ERRATA_814 - used to workaorund when the bandgap device | ||
| 322 | * has Errata 814 | ||
| 323 | * | ||
| 321 | * TI_BANDGAP_HAS(b, f) - macro to check if a bandgap device is capable of a | 324 | * TI_BANDGAP_HAS(b, f) - macro to check if a bandgap device is capable of a |
| 322 | * specific feature (above) or not. Return non-zero, if yes. | 325 | * specific feature (above) or not. Return non-zero, if yes. |
| 323 | */ | 326 | */ |
| @@ -331,6 +334,7 @@ struct ti_temp_sensor { | |||
| 331 | #define TI_BANDGAP_FEATURE_FREEZE_BIT BIT(7) | 334 | #define TI_BANDGAP_FEATURE_FREEZE_BIT BIT(7) |
| 332 | #define TI_BANDGAP_FEATURE_COUNTER_DELAY BIT(8) | 335 | #define TI_BANDGAP_FEATURE_COUNTER_DELAY BIT(8) |
| 333 | #define TI_BANDGAP_FEATURE_HISTORY_BUFFER BIT(9) | 336 | #define TI_BANDGAP_FEATURE_HISTORY_BUFFER BIT(9) |
| 337 | #define TI_BANDGAP_FEATURE_ERRATA_814 BIT(10) | ||
| 334 | #define TI_BANDGAP_HAS(b, f) \ | 338 | #define TI_BANDGAP_HAS(b, f) \ |
| 335 | ((b)->conf->features & TI_BANDGAP_FEATURE_ ## f) | 339 | ((b)->conf->features & TI_BANDGAP_FEATURE_ ## f) |
| 336 | 340 | ||
