diff options
author | Naveen Krishna Chatradhi <ch.naveen@samsung.com> | 2013-12-20 07:19:10 -0500 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2014-05-06 14:55:42 -0400 |
commit | 923488a53e7890566f298c2f67416af84ba2a21c (patch) | |
tree | 7bb07074128c4f541a9642f96bec1f95e01fe557 /drivers/thermal | |
parent | 14a11dc7e0dbf4acdd9c7b703ebd088f14def739 (diff) |
thermal: samsung: Add TMU support for Exynos5260 SoCs
This patch adds the registers, bit fields and compatible strings
required to support for the 5 TMU channels on Exynos5260.
Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/samsung/exynos_tmu.c | 5 | ||||
-rw-r--r-- | drivers/thermal/samsung/exynos_tmu.h | 2 | ||||
-rw-r--r-- | drivers/thermal/samsung/exynos_tmu_data.c | 92 | ||||
-rw-r--r-- | drivers/thermal/samsung/exynos_tmu_data.h | 19 |
4 files changed, 118 insertions, 0 deletions
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index bc50912a222d..2412090f5982 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c | |||
@@ -513,6 +513,10 @@ static const struct of_device_id exynos_tmu_match[] = { | |||
513 | .data = (void *)EXYNOS5250_TMU_DRV_DATA, | 513 | .data = (void *)EXYNOS5250_TMU_DRV_DATA, |
514 | }, | 514 | }, |
515 | { | 515 | { |
516 | .compatible = "samsung,exynos5260-tmu", | ||
517 | .data = (void *)EXYNOS5260_TMU_DRV_DATA, | ||
518 | }, | ||
519 | { | ||
516 | .compatible = "samsung,exynos5420-tmu", | 520 | .compatible = "samsung,exynos5420-tmu", |
517 | .data = (void *)EXYNOS5420_TMU_DRV_DATA, | 521 | .data = (void *)EXYNOS5420_TMU_DRV_DATA, |
518 | }, | 522 | }, |
@@ -674,6 +678,7 @@ static int exynos_tmu_probe(struct platform_device *pdev) | |||
674 | if (pdata->type == SOC_ARCH_EXYNOS4210 || | 678 | if (pdata->type == SOC_ARCH_EXYNOS4210 || |
675 | pdata->type == SOC_ARCH_EXYNOS4412 || | 679 | pdata->type == SOC_ARCH_EXYNOS4412 || |
676 | pdata->type == SOC_ARCH_EXYNOS5250 || | 680 | pdata->type == SOC_ARCH_EXYNOS5250 || |
681 | pdata->type == SOC_ARCH_EXYNOS5260 || | ||
677 | pdata->type == SOC_ARCH_EXYNOS5420_TRIMINFO || | 682 | pdata->type == SOC_ARCH_EXYNOS5420_TRIMINFO || |
678 | pdata->type == SOC_ARCH_EXYNOS5440) | 683 | pdata->type == SOC_ARCH_EXYNOS5440) |
679 | data->soc = pdata->type; | 684 | data->soc = pdata->type; |
diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h index 60cce2855fa8..edd08cf76729 100644 --- a/drivers/thermal/samsung/exynos_tmu.h +++ b/drivers/thermal/samsung/exynos_tmu.h | |||
@@ -43,6 +43,7 @@ enum soc_type { | |||
43 | SOC_ARCH_EXYNOS4210 = 1, | 43 | SOC_ARCH_EXYNOS4210 = 1, |
44 | SOC_ARCH_EXYNOS4412, | 44 | SOC_ARCH_EXYNOS4412, |
45 | SOC_ARCH_EXYNOS5250, | 45 | SOC_ARCH_EXYNOS5250, |
46 | SOC_ARCH_EXYNOS5260, | ||
46 | SOC_ARCH_EXYNOS5420_TRIMINFO, | 47 | SOC_ARCH_EXYNOS5420_TRIMINFO, |
47 | SOC_ARCH_EXYNOS5440, | 48 | SOC_ARCH_EXYNOS5440, |
48 | }; | 49 | }; |
@@ -150,6 +151,7 @@ struct exynos_tmu_registers { | |||
150 | u32 triminfo_85_shift; | 151 | u32 triminfo_85_shift; |
151 | 152 | ||
152 | u32 triminfo_ctrl; | 153 | u32 triminfo_ctrl; |
154 | u32 triminfo_ctrl1; | ||
153 | u32 triminfo_reload_shift; | 155 | u32 triminfo_reload_shift; |
154 | 156 | ||
155 | u32 tmu_ctrl; | 157 | u32 tmu_ctrl; |
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c index e597f61a15f9..c1d81dcd7819 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.c +++ b/drivers/thermal/samsung/exynos_tmu_data.c | |||
@@ -194,6 +194,98 @@ struct exynos_tmu_init_data const exynos5250_default_tmu_data = { | |||
194 | }; | 194 | }; |
195 | #endif | 195 | #endif |
196 | 196 | ||
197 | #if defined(CONFIG_SOC_EXYNOS5260) | ||
198 | static const struct exynos_tmu_registers exynos5260_tmu_registers = { | ||
199 | .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, | ||
200 | .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT, | ||
201 | .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT, | ||
202 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, | ||
203 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL1, | ||
204 | .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT, | ||
205 | .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK, | ||
206 | .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, | ||
207 | .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, | ||
208 | .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, | ||
209 | .buf_slope_sel_shift = EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT, | ||
210 | .buf_slope_sel_mask = EXYNOS_TMU_BUF_SLOPE_SEL_MASK, | ||
211 | .core_en_shift = EXYNOS_TMU_CORE_EN_SHIFT, | ||
212 | .tmu_status = EXYNOS_TMU_REG_STATUS, | ||
213 | .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP, | ||
214 | .threshold_th0 = EXYNOS_THD_TEMP_RISE, | ||
215 | .threshold_th1 = EXYNOS_THD_TEMP_FALL, | ||
216 | .tmu_inten = EXYNOS5260_TMU_REG_INTEN, | ||
217 | .inten_rise0_shift = EXYNOS_TMU_INTEN_RISE0_SHIFT, | ||
218 | .inten_rise1_shift = EXYNOS_TMU_INTEN_RISE1_SHIFT, | ||
219 | .inten_rise2_shift = EXYNOS_TMU_INTEN_RISE2_SHIFT, | ||
220 | .inten_rise3_shift = EXYNOS_TMU_INTEN_RISE3_SHIFT, | ||
221 | .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT, | ||
222 | .tmu_intstat = EXYNOS5260_TMU_REG_INTSTAT, | ||
223 | .tmu_intclear = EXYNOS5260_TMU_REG_INTCLEAR, | ||
224 | .intclr_fall_shift = EXYNOS5420_TMU_CLEAR_FALL_INT_SHIFT, | ||
225 | .intclr_rise_shift = EXYNOS_TMU_RISE_INT_SHIFT, | ||
226 | .intclr_rise_mask = EXYNOS5260_TMU_RISE_INT_MASK, | ||
227 | .intclr_fall_mask = EXYNOS5260_TMU_FALL_INT_MASK, | ||
228 | .emul_con = EXYNOS5260_EMUL_CON, | ||
229 | .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, | ||
230 | .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT, | ||
231 | .emul_time_mask = EXYNOS_EMUL_TIME_MASK, | ||
232 | }; | ||
233 | |||
234 | #define __EXYNOS5260_TMU_DATA \ | ||
235 | .threshold_falling = 10, \ | ||
236 | .trigger_levels[0] = 85, \ | ||
237 | .trigger_levels[1] = 103, \ | ||
238 | .trigger_levels[2] = 110, \ | ||
239 | .trigger_levels[3] = 120, \ | ||
240 | .trigger_enable[0] = true, \ | ||
241 | .trigger_enable[1] = true, \ | ||
242 | .trigger_enable[2] = true, \ | ||
243 | .trigger_enable[3] = false, \ | ||
244 | .trigger_type[0] = THROTTLE_ACTIVE, \ | ||
245 | .trigger_type[1] = THROTTLE_ACTIVE, \ | ||
246 | .trigger_type[2] = SW_TRIP, \ | ||
247 | .trigger_type[3] = HW_TRIP, \ | ||
248 | .max_trigger_level = 4, \ | ||
249 | .gain = 8, \ | ||
250 | .reference_voltage = 16, \ | ||
251 | .noise_cancel_mode = 4, \ | ||
252 | .cal_type = TYPE_ONE_POINT_TRIMMING, \ | ||
253 | .efuse_value = 55, \ | ||
254 | .min_efuse_value = 40, \ | ||
255 | .max_efuse_value = 100, \ | ||
256 | .first_point_trim = 25, \ | ||
257 | .second_point_trim = 85, \ | ||
258 | .default_temp_offset = 50, \ | ||
259 | .freq_tab[0] = { \ | ||
260 | .freq_clip_max = 800 * 1000, \ | ||
261 | .temp_level = 85, \ | ||
262 | }, \ | ||
263 | .freq_tab[1] = { \ | ||
264 | .freq_clip_max = 200 * 1000, \ | ||
265 | .temp_level = 103, \ | ||
266 | }, \ | ||
267 | .freq_tab_count = 2, \ | ||
268 | .registers = &exynos5260_tmu_registers, \ | ||
269 | |||
270 | #define EXYNOS5260_TMU_DATA \ | ||
271 | __EXYNOS5260_TMU_DATA \ | ||
272 | .type = SOC_ARCH_EXYNOS5260, \ | ||
273 | .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ | ||
274 | TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ | ||
275 | TMU_SUPPORT_EMUL_TIME) | ||
276 | |||
277 | struct exynos_tmu_init_data const exynos5260_default_tmu_data = { | ||
278 | .tmu_data = { | ||
279 | { EXYNOS5260_TMU_DATA }, | ||
280 | { EXYNOS5260_TMU_DATA }, | ||
281 | { EXYNOS5260_TMU_DATA }, | ||
282 | { EXYNOS5260_TMU_DATA }, | ||
283 | { EXYNOS5260_TMU_DATA }, | ||
284 | }, | ||
285 | .tmu_count = 5, | ||
286 | }; | ||
287 | #endif | ||
288 | |||
197 | #if defined(CONFIG_SOC_EXYNOS5420) | 289 | #if defined(CONFIG_SOC_EXYNOS5420) |
198 | static const struct exynos_tmu_registers exynos5420_tmu_registers = { | 290 | static const struct exynos_tmu_registers exynos5420_tmu_registers = { |
199 | .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, | 291 | .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, |
diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h index 41f06dc70849..d268981b65e5 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.h +++ b/drivers/thermal/samsung/exynos_tmu_data.h | |||
@@ -87,6 +87,7 @@ | |||
87 | #define EXYNOS_TMU_INTEN_FALL0_SHIFT 16 | 87 | #define EXYNOS_TMU_INTEN_FALL0_SHIFT 16 |
88 | #define EXYNOS_TMU_INTEN_FALL1_SHIFT 20 | 88 | #define EXYNOS_TMU_INTEN_FALL1_SHIFT 20 |
89 | #define EXYNOS_TMU_INTEN_FALL2_SHIFT 24 | 89 | #define EXYNOS_TMU_INTEN_FALL2_SHIFT 24 |
90 | #define EXYNOS_TMU_INTEN_FALL3_SHIFT 28 | ||
90 | 91 | ||
91 | #define EXYNOS_EMUL_TIME 0x57F0 | 92 | #define EXYNOS_EMUL_TIME 0x57F0 |
92 | #define EXYNOS_EMUL_TIME_MASK 0xffff | 93 | #define EXYNOS_EMUL_TIME_MASK 0xffff |
@@ -97,6 +98,17 @@ | |||
97 | 98 | ||
98 | #define EXYNOS_MAX_TRIGGER_PER_REG 4 | 99 | #define EXYNOS_MAX_TRIGGER_PER_REG 4 |
99 | 100 | ||
101 | /* Exynos5260 specific */ | ||
102 | #define EXYNOS_TMU_REG_CONTROL1 0x24 | ||
103 | #define EXYNOS5260_TMU_REG_INTEN 0xC0 | ||
104 | #define EXYNOS5260_TMU_REG_INTSTAT 0xC4 | ||
105 | #define EXYNOS5260_TMU_REG_INTCLEAR 0xC8 | ||
106 | #define EXYNOS5260_TMU_CLEAR_RISE_INT 0x1111 | ||
107 | #define EXYNOS5260_TMU_CLEAR_FALL_INT (0x1111 << 16) | ||
108 | #define EXYNOS5260_TMU_RISE_INT_MASK 0x1111 | ||
109 | #define EXYNOS5260_TMU_FALL_INT_MASK 0x1111 | ||
110 | #define EXYNOS5260_EMUL_CON 0x100 | ||
111 | |||
100 | /* Exynos4412 specific */ | 112 | /* Exynos4412 specific */ |
101 | #define EXYNOS4412_MUX_ADDR_VALUE 6 | 113 | #define EXYNOS4412_MUX_ADDR_VALUE 6 |
102 | #define EXYNOS4412_MUX_ADDR_SHIFT 20 | 114 | #define EXYNOS4412_MUX_ADDR_SHIFT 20 |
@@ -157,6 +169,13 @@ extern struct exynos_tmu_init_data const exynos5250_default_tmu_data; | |||
157 | #define EXYNOS5250_TMU_DRV_DATA (NULL) | 169 | #define EXYNOS5250_TMU_DRV_DATA (NULL) |
158 | #endif | 170 | #endif |
159 | 171 | ||
172 | #if defined(CONFIG_SOC_EXYNOS5260) | ||
173 | extern struct exynos_tmu_init_data const exynos5260_default_tmu_data; | ||
174 | #define EXYNOS5260_TMU_DRV_DATA (&exynos5260_default_tmu_data) | ||
175 | #else | ||
176 | #define EXYNOS5260_TMU_DRV_DATA (NULL) | ||
177 | #endif | ||
178 | |||
160 | #if defined(CONFIG_SOC_EXYNOS5420) | 179 | #if defined(CONFIG_SOC_EXYNOS5420) |
161 | extern struct exynos_tmu_init_data const exynos5420_default_tmu_data; | 180 | extern struct exynos_tmu_init_data const exynos5420_default_tmu_data; |
162 | #define EXYNOS5420_TMU_DRV_DATA (&exynos5420_default_tmu_data) | 181 | #define EXYNOS5420_TMU_DRV_DATA (&exynos5420_default_tmu_data) |