18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * OMAP4xxx 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 __OMAP4XXX_BANDGAP_H 108c2ecf20Sopenharmony_ci#define __OMAP4XXX_BANDGAP_H 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci/** 138c2ecf20Sopenharmony_ci * *** OMAP4430 *** 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * Below, in sequence, are the Register definitions, 168c2ecf20Sopenharmony_ci * the bitfields and the temperature definitions for OMAP4430. 178c2ecf20Sopenharmony_ci */ 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci/** 208c2ecf20Sopenharmony_ci * OMAP4430 register definitions 218c2ecf20Sopenharmony_ci * 228c2ecf20Sopenharmony_ci * Registers are defined as offsets. The offsets are 238c2ecf20Sopenharmony_ci * relative to FUSE_OPP_BGAP on 4430. 248c2ecf20Sopenharmony_ci */ 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* OMAP4430.FUSE_OPP_BGAP */ 278c2ecf20Sopenharmony_ci#define OMAP4430_FUSE_OPP_BGAP 0x0 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci/* OMAP4430.TEMP_SENSOR */ 308c2ecf20Sopenharmony_ci#define OMAP4430_TEMP_SENSOR_CTRL_OFFSET 0xCC 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci/** 338c2ecf20Sopenharmony_ci * Register and bit definitions for OMAP4430 348c2ecf20Sopenharmony_ci * 358c2ecf20Sopenharmony_ci * All the macros bellow define the required bits for 368c2ecf20Sopenharmony_ci * controlling temperature on OMAP4430. Bit defines are 378c2ecf20Sopenharmony_ci * grouped by register. 388c2ecf20Sopenharmony_ci */ 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci/* OMAP4430.TEMP_SENSOR bits */ 418c2ecf20Sopenharmony_ci#define OMAP4430_BGAP_TEMPSOFF_MASK BIT(12) 428c2ecf20Sopenharmony_ci#define OMAP4430_BGAP_TSHUT_MASK BIT(11) 438c2ecf20Sopenharmony_ci#define OMAP4430_SINGLE_MODE_MASK BIT(10) 448c2ecf20Sopenharmony_ci#define OMAP4430_BGAP_TEMP_SENSOR_SOC_MASK BIT(9) 458c2ecf20Sopenharmony_ci#define OMAP4430_BGAP_TEMP_SENSOR_EOCZ_MASK BIT(8) 468c2ecf20Sopenharmony_ci#define OMAP4430_BGAP_TEMP_SENSOR_DTEMP_MASK (0xff << 0) 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci/** 498c2ecf20Sopenharmony_ci * Temperature limits and thresholds for OMAP4430 508c2ecf20Sopenharmony_ci * 518c2ecf20Sopenharmony_ci * All the macros bellow are definitions for handling the 528c2ecf20Sopenharmony_ci * ADC conversions and representation of temperature limits 538c2ecf20Sopenharmony_ci * and thresholds for OMAP4430. 548c2ecf20Sopenharmony_ci */ 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci/* 578c2ecf20Sopenharmony_ci * ADC conversion table limits. Ignore values outside the TRM listed 588c2ecf20Sopenharmony_ci * range to avoid bogus thermal shutdowns. See omap4430 TRM chapter 598c2ecf20Sopenharmony_ci * "18.4.10.2.3 ADC Codes Versus Temperature". 608c2ecf20Sopenharmony_ci */ 618c2ecf20Sopenharmony_ci#define OMAP4430_ADC_START_VALUE 13 628c2ecf20Sopenharmony_ci#define OMAP4430_ADC_END_VALUE 107 638c2ecf20Sopenharmony_ci/* bandgap clock limits (no control on 4430) */ 648c2ecf20Sopenharmony_ci#define OMAP4430_MAX_FREQ 32768 658c2ecf20Sopenharmony_ci#define OMAP4430_MIN_FREQ 32768 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci/** 688c2ecf20Sopenharmony_ci * *** OMAP4460 *** Applicable for OMAP4470 698c2ecf20Sopenharmony_ci * 708c2ecf20Sopenharmony_ci * Below, in sequence, are the Register definitions, 718c2ecf20Sopenharmony_ci * the bitfields and the temperature definitions for OMAP4460. 728c2ecf20Sopenharmony_ci */ 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci/** 758c2ecf20Sopenharmony_ci * OMAP4460 register definitions 768c2ecf20Sopenharmony_ci * 778c2ecf20Sopenharmony_ci * Registers are defined as offsets. The offsets are 788c2ecf20Sopenharmony_ci * relative to FUSE_OPP_BGAP on 4460. 798c2ecf20Sopenharmony_ci */ 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci/* OMAP4460.FUSE_OPP_BGAP */ 828c2ecf20Sopenharmony_ci#define OMAP4460_FUSE_OPP_BGAP 0x0 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci/* OMAP4460.TEMP_SENSOR */ 858c2ecf20Sopenharmony_ci#define OMAP4460_TEMP_SENSOR_CTRL_OFFSET 0xCC 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci/* OMAP4460.BANDGAP_CTRL */ 888c2ecf20Sopenharmony_ci#define OMAP4460_BGAP_CTRL_OFFSET 0x118 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci/* OMAP4460.BANDGAP_COUNTER */ 918c2ecf20Sopenharmony_ci#define OMAP4460_BGAP_COUNTER_OFFSET 0x11C 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci/* OMAP4460.BANDGAP_THRESHOLD */ 948c2ecf20Sopenharmony_ci#define OMAP4460_BGAP_THRESHOLD_OFFSET 0x120 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci/* OMAP4460.TSHUT_THRESHOLD */ 978c2ecf20Sopenharmony_ci#define OMAP4460_BGAP_TSHUT_OFFSET 0x124 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci/* OMAP4460.BANDGAP_STATUS */ 1008c2ecf20Sopenharmony_ci#define OMAP4460_BGAP_STATUS_OFFSET 0x128 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci/** 1038c2ecf20Sopenharmony_ci * Register bitfields for OMAP4460 1048c2ecf20Sopenharmony_ci * 1058c2ecf20Sopenharmony_ci * All the macros bellow define the required bits for 1068c2ecf20Sopenharmony_ci * controlling temperature on OMAP4460. Bit defines are 1078c2ecf20Sopenharmony_ci * grouped by register. 1088c2ecf20Sopenharmony_ci */ 1098c2ecf20Sopenharmony_ci/* OMAP4460.TEMP_SENSOR bits */ 1108c2ecf20Sopenharmony_ci#define OMAP4460_BGAP_TEMPSOFF_MASK BIT(13) 1118c2ecf20Sopenharmony_ci#define OMAP4460_BGAP_TEMP_SENSOR_SOC_MASK BIT(11) 1128c2ecf20Sopenharmony_ci#define OMAP4460_BGAP_TEMP_SENSOR_EOCZ_MASK BIT(10) 1138c2ecf20Sopenharmony_ci#define OMAP4460_BGAP_TEMP_SENSOR_DTEMP_MASK (0x3ff << 0) 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci/* OMAP4460.BANDGAP_CTRL bits */ 1168c2ecf20Sopenharmony_ci#define OMAP4460_SINGLE_MODE_MASK BIT(31) 1178c2ecf20Sopenharmony_ci#define OMAP4460_MASK_HOT_MASK BIT(1) 1188c2ecf20Sopenharmony_ci#define OMAP4460_MASK_COLD_MASK BIT(0) 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci/* OMAP4460.BANDGAP_COUNTER bits */ 1218c2ecf20Sopenharmony_ci#define OMAP4460_COUNTER_MASK (0xffffff << 0) 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci/* OMAP4460.BANDGAP_THRESHOLD bits */ 1248c2ecf20Sopenharmony_ci#define OMAP4460_T_HOT_MASK (0x3ff << 16) 1258c2ecf20Sopenharmony_ci#define OMAP4460_T_COLD_MASK (0x3ff << 0) 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci/* OMAP4460.TSHUT_THRESHOLD bits */ 1288c2ecf20Sopenharmony_ci#define OMAP4460_TSHUT_HOT_MASK (0x3ff << 16) 1298c2ecf20Sopenharmony_ci#define OMAP4460_TSHUT_COLD_MASK (0x3ff << 0) 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci/* OMAP4460.BANDGAP_STATUS bits */ 1328c2ecf20Sopenharmony_ci#define OMAP4460_HOT_FLAG_MASK BIT(1) 1338c2ecf20Sopenharmony_ci#define OMAP4460_COLD_FLAG_MASK BIT(0) 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci/** 1368c2ecf20Sopenharmony_ci * Temperature limits and thresholds for OMAP4460 1378c2ecf20Sopenharmony_ci * 1388c2ecf20Sopenharmony_ci * All the macros bellow are definitions for handling the 1398c2ecf20Sopenharmony_ci * ADC conversions and representation of temperature limits 1408c2ecf20Sopenharmony_ci * and thresholds for OMAP4460. 1418c2ecf20Sopenharmony_ci */ 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci/* ADC conversion table limits */ 1448c2ecf20Sopenharmony_ci#define OMAP4460_ADC_START_VALUE 530 1458c2ecf20Sopenharmony_ci#define OMAP4460_ADC_END_VALUE 932 1468c2ecf20Sopenharmony_ci/* bandgap clock limits */ 1478c2ecf20Sopenharmony_ci#define OMAP4460_MAX_FREQ 1500000 1488c2ecf20Sopenharmony_ci#define OMAP4460_MIN_FREQ 1000000 1498c2ecf20Sopenharmony_ci/* interrupts thresholds */ 1508c2ecf20Sopenharmony_ci#define OMAP4460_TSHUT_HOT 900 /* 122 deg C */ 1518c2ecf20Sopenharmony_ci#define OMAP4460_TSHUT_COLD 895 /* 100 deg C */ 1528c2ecf20Sopenharmony_ci#define OMAP4460_T_HOT 800 /* 73 deg C */ 1538c2ecf20Sopenharmony_ci#define OMAP4460_T_COLD 795 /* 71 deg C */ 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_ci#endif /* __OMAP4XXX_BANDGAP_H */ 156