18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * OMAP5xxx bandgap registers, bitfields and temperature definitions
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
68c2ecf20Sopenharmony_ci * Contact:
78c2ecf20Sopenharmony_ci *   Eduardo Valentin <eduardo.valentin@ti.com>
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci#ifndef __OMAP5XXX_BANDGAP_H
108c2ecf20Sopenharmony_ci#define __OMAP5XXX_BANDGAP_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/**
138c2ecf20Sopenharmony_ci * *** OMAP5430 ***
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * Below, in sequence, are the Register definitions,
168c2ecf20Sopenharmony_ci * the bitfields and the temperature definitions for OMAP5430.
178c2ecf20Sopenharmony_ci */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/**
208c2ecf20Sopenharmony_ci * OMAP5430 register definitions
218c2ecf20Sopenharmony_ci *
228c2ecf20Sopenharmony_ci * Registers are defined as offsets. The offsets are
238c2ecf20Sopenharmony_ci * relative to FUSE_OPP_BGAP_GPU on 5430.
248c2ecf20Sopenharmony_ci *
258c2ecf20Sopenharmony_ci * Register below are grouped by domain (not necessarily in offset order)
268c2ecf20Sopenharmony_ci */
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* OMAP5430.GPU register offsets */
298c2ecf20Sopenharmony_ci#define OMAP5430_FUSE_OPP_BGAP_GPU			0x0
308c2ecf20Sopenharmony_ci#define OMAP5430_TEMP_SENSOR_GPU_OFFSET			0x150
318c2ecf20Sopenharmony_ci#define OMAP5430_BGAP_THRESHOLD_GPU_OFFSET		0x1A8
328c2ecf20Sopenharmony_ci#define OMAP5430_BGAP_TSHUT_GPU_OFFSET			0x1B4
338c2ecf20Sopenharmony_ci#define OMAP5430_BGAP_DTEMP_GPU_1_OFFSET		0x1F8
348c2ecf20Sopenharmony_ci#define OMAP5430_BGAP_DTEMP_GPU_2_OFFSET		0x1FC
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* OMAP5430.MPU register offsets */
378c2ecf20Sopenharmony_ci#define OMAP5430_FUSE_OPP_BGAP_MPU			0x4
388c2ecf20Sopenharmony_ci#define OMAP5430_TEMP_SENSOR_MPU_OFFSET			0x14C
398c2ecf20Sopenharmony_ci#define OMAP5430_BGAP_THRESHOLD_MPU_OFFSET		0x1A4
408c2ecf20Sopenharmony_ci#define OMAP5430_BGAP_TSHUT_MPU_OFFSET			0x1B0
418c2ecf20Sopenharmony_ci#define OMAP5430_BGAP_DTEMP_MPU_1_OFFSET		0x1E4
428c2ecf20Sopenharmony_ci#define OMAP5430_BGAP_DTEMP_MPU_2_OFFSET		0x1E8
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/* OMAP5430.MPU register offsets */
458c2ecf20Sopenharmony_ci#define OMAP5430_FUSE_OPP_BGAP_CORE			0x8
468c2ecf20Sopenharmony_ci#define OMAP5430_TEMP_SENSOR_CORE_OFFSET		0x154
478c2ecf20Sopenharmony_ci#define OMAP5430_BGAP_THRESHOLD_CORE_OFFSET		0x1AC
488c2ecf20Sopenharmony_ci#define OMAP5430_BGAP_TSHUT_CORE_OFFSET			0x1B8
498c2ecf20Sopenharmony_ci#define OMAP5430_BGAP_DTEMP_CORE_1_OFFSET		0x20C
508c2ecf20Sopenharmony_ci#define OMAP5430_BGAP_DTEMP_CORE_2_OFFSET		0x210
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/* OMAP5430.common register offsets */
538c2ecf20Sopenharmony_ci#define OMAP5430_BGAP_CTRL_OFFSET			0x1A0
548c2ecf20Sopenharmony_ci#define OMAP5430_BGAP_STATUS_OFFSET			0x1C8
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci/**
578c2ecf20Sopenharmony_ci * Register bitfields for OMAP5430
588c2ecf20Sopenharmony_ci *
598c2ecf20Sopenharmony_ci * All the macros bellow define the required bits for
608c2ecf20Sopenharmony_ci * controlling temperature on OMAP5430. Bit defines are
618c2ecf20Sopenharmony_ci * grouped by register.
628c2ecf20Sopenharmony_ci */
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci/* OMAP5430.TEMP_SENSOR */
658c2ecf20Sopenharmony_ci#define OMAP5430_BGAP_TEMP_SENSOR_SOC_MASK		BIT(12)
668c2ecf20Sopenharmony_ci#define OMAP5430_BGAP_TEMPSOFF_MASK			BIT(11)
678c2ecf20Sopenharmony_ci#define OMAP5430_BGAP_TEMP_SENSOR_EOCZ_MASK		BIT(10)
688c2ecf20Sopenharmony_ci#define OMAP5430_BGAP_TEMP_SENSOR_DTEMP_MASK		(0x3ff << 0)
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci/* OMAP5430.BANDGAP_CTRL */
718c2ecf20Sopenharmony_ci#define OMAP5430_MASK_COUNTER_DELAY_MASK		(0x7 << 27)
728c2ecf20Sopenharmony_ci#define OMAP5430_MASK_FREEZE_CORE_MASK			BIT(23)
738c2ecf20Sopenharmony_ci#define OMAP5430_MASK_FREEZE_GPU_MASK			BIT(22)
748c2ecf20Sopenharmony_ci#define OMAP5430_MASK_FREEZE_MPU_MASK			BIT(21)
758c2ecf20Sopenharmony_ci#define OMAP5430_MASK_HOT_CORE_MASK			BIT(5)
768c2ecf20Sopenharmony_ci#define OMAP5430_MASK_COLD_CORE_MASK			BIT(4)
778c2ecf20Sopenharmony_ci#define OMAP5430_MASK_HOT_GPU_MASK			BIT(3)
788c2ecf20Sopenharmony_ci#define OMAP5430_MASK_COLD_GPU_MASK			BIT(2)
798c2ecf20Sopenharmony_ci#define OMAP5430_MASK_HOT_MPU_MASK			BIT(1)
808c2ecf20Sopenharmony_ci#define OMAP5430_MASK_COLD_MPU_MASK			BIT(0)
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci/* OMAP5430.BANDGAP_COUNTER */
838c2ecf20Sopenharmony_ci#define OMAP5430_COUNTER_MASK				(0xffffff << 0)
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci/* OMAP5430.BANDGAP_THRESHOLD */
868c2ecf20Sopenharmony_ci#define OMAP5430_T_HOT_MASK				(0x3ff << 16)
878c2ecf20Sopenharmony_ci#define OMAP5430_T_COLD_MASK				(0x3ff << 0)
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci/* OMAP5430.TSHUT_THRESHOLD */
908c2ecf20Sopenharmony_ci#define OMAP5430_TSHUT_HOT_MASK				(0x3ff << 16)
918c2ecf20Sopenharmony_ci#define OMAP5430_TSHUT_COLD_MASK			(0x3ff << 0)
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci/* OMAP5430.BANDGAP_STATUS */
948c2ecf20Sopenharmony_ci#define OMAP5430_HOT_CORE_FLAG_MASK			BIT(5)
958c2ecf20Sopenharmony_ci#define OMAP5430_COLD_CORE_FLAG_MASK			BIT(4)
968c2ecf20Sopenharmony_ci#define OMAP5430_HOT_GPU_FLAG_MASK			BIT(3)
978c2ecf20Sopenharmony_ci#define OMAP5430_COLD_GPU_FLAG_MASK			BIT(2)
988c2ecf20Sopenharmony_ci#define OMAP5430_HOT_MPU_FLAG_MASK			BIT(1)
998c2ecf20Sopenharmony_ci#define OMAP5430_COLD_MPU_FLAG_MASK			BIT(0)
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci/**
1028c2ecf20Sopenharmony_ci * Temperature limits and thresholds for OMAP5430
1038c2ecf20Sopenharmony_ci *
1048c2ecf20Sopenharmony_ci * All the macros bellow are definitions for handling the
1058c2ecf20Sopenharmony_ci * ADC conversions and representation of temperature limits
1068c2ecf20Sopenharmony_ci * and thresholds for OMAP5430. Definitions are grouped
1078c2ecf20Sopenharmony_ci * by temperature domain.
1088c2ecf20Sopenharmony_ci */
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci/* OMAP5430.common temperature definitions */
1118c2ecf20Sopenharmony_ci/* ADC conversion table limits */
1128c2ecf20Sopenharmony_ci#define OMAP5430_ADC_START_VALUE			540
1138c2ecf20Sopenharmony_ci#define OMAP5430_ADC_END_VALUE				945
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci/* OMAP5430.GPU temperature definitions */
1168c2ecf20Sopenharmony_ci/* bandgap clock limits */
1178c2ecf20Sopenharmony_ci#define OMAP5430_GPU_MAX_FREQ				1500000
1188c2ecf20Sopenharmony_ci#define OMAP5430_GPU_MIN_FREQ				1000000
1198c2ecf20Sopenharmony_ci/* interrupts thresholds */
1208c2ecf20Sopenharmony_ci#define OMAP5430_GPU_TSHUT_HOT				915
1218c2ecf20Sopenharmony_ci#define OMAP5430_GPU_TSHUT_COLD				900
1228c2ecf20Sopenharmony_ci#define OMAP5430_GPU_T_HOT				800
1238c2ecf20Sopenharmony_ci#define OMAP5430_GPU_T_COLD				795
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci/* OMAP5430.MPU temperature definitions */
1268c2ecf20Sopenharmony_ci/* bandgap clock limits */
1278c2ecf20Sopenharmony_ci#define OMAP5430_MPU_MAX_FREQ				1500000
1288c2ecf20Sopenharmony_ci#define OMAP5430_MPU_MIN_FREQ				1000000
1298c2ecf20Sopenharmony_ci/* interrupts thresholds */
1308c2ecf20Sopenharmony_ci#define OMAP5430_MPU_TSHUT_HOT				915
1318c2ecf20Sopenharmony_ci#define OMAP5430_MPU_TSHUT_COLD				900
1328c2ecf20Sopenharmony_ci#define OMAP5430_MPU_T_HOT				800
1338c2ecf20Sopenharmony_ci#define OMAP5430_MPU_T_COLD				795
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci/* OMAP5430.CORE temperature definitions */
1368c2ecf20Sopenharmony_ci/* bandgap clock limits */
1378c2ecf20Sopenharmony_ci#define OMAP5430_CORE_MAX_FREQ				1500000
1388c2ecf20Sopenharmony_ci#define OMAP5430_CORE_MIN_FREQ				1000000
1398c2ecf20Sopenharmony_ci/* interrupts thresholds */
1408c2ecf20Sopenharmony_ci#define OMAP5430_CORE_TSHUT_HOT				915
1418c2ecf20Sopenharmony_ci#define OMAP5430_CORE_TSHUT_COLD			900
1428c2ecf20Sopenharmony_ci#define OMAP5430_CORE_T_HOT				800
1438c2ecf20Sopenharmony_ci#define OMAP5430_CORE_T_COLD				795
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci#endif /* __OMAP5XXX_BANDGAP_H */
146