162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * OMAP4xxx bandgap registers, bitfields and temperature definitions 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ 662306a36Sopenharmony_ci * Contact: 762306a36Sopenharmony_ci * Eduardo Valentin <eduardo.valentin@ti.com> 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci#ifndef __OMAP4XXX_BANDGAP_H 1062306a36Sopenharmony_ci#define __OMAP4XXX_BANDGAP_H 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci/** 1362306a36Sopenharmony_ci * *** OMAP4430 *** 1462306a36Sopenharmony_ci * 1562306a36Sopenharmony_ci * Below, in sequence, are the Register definitions, 1662306a36Sopenharmony_ci * the bitfields and the temperature definitions for OMAP4430. 1762306a36Sopenharmony_ci */ 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci/** 2062306a36Sopenharmony_ci * OMAP4430 register definitions 2162306a36Sopenharmony_ci * 2262306a36Sopenharmony_ci * Registers are defined as offsets. The offsets are 2362306a36Sopenharmony_ci * relative to FUSE_OPP_BGAP on 4430. 2462306a36Sopenharmony_ci */ 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci/* OMAP4430.FUSE_OPP_BGAP */ 2762306a36Sopenharmony_ci#define OMAP4430_FUSE_OPP_BGAP 0x0 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci/* OMAP4430.TEMP_SENSOR */ 3062306a36Sopenharmony_ci#define OMAP4430_TEMP_SENSOR_CTRL_OFFSET 0xCC 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci/** 3362306a36Sopenharmony_ci * Register and bit definitions for OMAP4430 3462306a36Sopenharmony_ci * 3562306a36Sopenharmony_ci * All the macros bellow define the required bits for 3662306a36Sopenharmony_ci * controlling temperature on OMAP4430. Bit defines are 3762306a36Sopenharmony_ci * grouped by register. 3862306a36Sopenharmony_ci */ 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci/* OMAP4430.TEMP_SENSOR bits */ 4162306a36Sopenharmony_ci#define OMAP4430_BGAP_TEMPSOFF_MASK BIT(12) 4262306a36Sopenharmony_ci#define OMAP4430_BGAP_TSHUT_MASK BIT(11) 4362306a36Sopenharmony_ci#define OMAP4430_CONTINUOUS_MODE_MASK BIT(10) 4462306a36Sopenharmony_ci#define OMAP4430_BGAP_TEMP_SENSOR_SOC_MASK BIT(9) 4562306a36Sopenharmony_ci#define OMAP4430_BGAP_TEMP_SENSOR_EOCZ_MASK BIT(8) 4662306a36Sopenharmony_ci#define OMAP4430_BGAP_TEMP_SENSOR_DTEMP_MASK (0xff << 0) 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci/** 4962306a36Sopenharmony_ci * Temperature limits and thresholds for OMAP4430 5062306a36Sopenharmony_ci * 5162306a36Sopenharmony_ci * All the macros bellow are definitions for handling the 5262306a36Sopenharmony_ci * ADC conversions and representation of temperature limits 5362306a36Sopenharmony_ci * and thresholds for OMAP4430. 5462306a36Sopenharmony_ci */ 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci/* 5762306a36Sopenharmony_ci * ADC conversion table limits. Ignore values outside the TRM listed 5862306a36Sopenharmony_ci * range to avoid bogus thermal shutdowns. See omap4430 TRM chapter 5962306a36Sopenharmony_ci * "18.4.10.2.3 ADC Codes Versus Temperature". 6062306a36Sopenharmony_ci */ 6162306a36Sopenharmony_ci#define OMAP4430_ADC_START_VALUE 13 6262306a36Sopenharmony_ci#define OMAP4430_ADC_END_VALUE 107 6362306a36Sopenharmony_ci/* bandgap clock limits (no control on 4430) */ 6462306a36Sopenharmony_ci#define OMAP4430_MAX_FREQ 32768 6562306a36Sopenharmony_ci#define OMAP4430_MIN_FREQ 32768 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci/** 6862306a36Sopenharmony_ci * *** OMAP4460 *** Applicable for OMAP4470 6962306a36Sopenharmony_ci * 7062306a36Sopenharmony_ci * Below, in sequence, are the Register definitions, 7162306a36Sopenharmony_ci * the bitfields and the temperature definitions for OMAP4460. 7262306a36Sopenharmony_ci */ 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci/** 7562306a36Sopenharmony_ci * OMAP4460 register definitions 7662306a36Sopenharmony_ci * 7762306a36Sopenharmony_ci * Registers are defined as offsets. The offsets are 7862306a36Sopenharmony_ci * relative to FUSE_OPP_BGAP on 4460. 7962306a36Sopenharmony_ci */ 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci/* OMAP4460.FUSE_OPP_BGAP */ 8262306a36Sopenharmony_ci#define OMAP4460_FUSE_OPP_BGAP 0x0 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci/* OMAP4460.TEMP_SENSOR */ 8562306a36Sopenharmony_ci#define OMAP4460_TEMP_SENSOR_CTRL_OFFSET 0xCC 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ci/* OMAP4460.BANDGAP_CTRL */ 8862306a36Sopenharmony_ci#define OMAP4460_BGAP_CTRL_OFFSET 0x118 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_ci/* OMAP4460.BANDGAP_COUNTER */ 9162306a36Sopenharmony_ci#define OMAP4460_BGAP_COUNTER_OFFSET 0x11C 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci/* OMAP4460.BANDGAP_THRESHOLD */ 9462306a36Sopenharmony_ci#define OMAP4460_BGAP_THRESHOLD_OFFSET 0x120 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci/* OMAP4460.TSHUT_THRESHOLD */ 9762306a36Sopenharmony_ci#define OMAP4460_BGAP_TSHUT_OFFSET 0x124 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci/* OMAP4460.BANDGAP_STATUS */ 10062306a36Sopenharmony_ci#define OMAP4460_BGAP_STATUS_OFFSET 0x128 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_ci/** 10362306a36Sopenharmony_ci * Register bitfields for OMAP4460 10462306a36Sopenharmony_ci * 10562306a36Sopenharmony_ci * All the macros bellow define the required bits for 10662306a36Sopenharmony_ci * controlling temperature on OMAP4460. Bit defines are 10762306a36Sopenharmony_ci * grouped by register. 10862306a36Sopenharmony_ci */ 10962306a36Sopenharmony_ci/* OMAP4460.TEMP_SENSOR bits */ 11062306a36Sopenharmony_ci#define OMAP4460_BGAP_TEMPSOFF_MASK BIT(13) 11162306a36Sopenharmony_ci#define OMAP4460_BGAP_TEMP_SENSOR_SOC_MASK BIT(11) 11262306a36Sopenharmony_ci#define OMAP4460_BGAP_TEMP_SENSOR_EOCZ_MASK BIT(10) 11362306a36Sopenharmony_ci#define OMAP4460_BGAP_TEMP_SENSOR_DTEMP_MASK (0x3ff << 0) 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ci/* OMAP4460.BANDGAP_CTRL bits */ 11662306a36Sopenharmony_ci#define OMAP4460_CONTINUOUS_MODE_MASK BIT(31) 11762306a36Sopenharmony_ci#define OMAP4460_MASK_HOT_MASK BIT(1) 11862306a36Sopenharmony_ci#define OMAP4460_MASK_COLD_MASK BIT(0) 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci/* OMAP4460.BANDGAP_COUNTER bits */ 12162306a36Sopenharmony_ci#define OMAP4460_COUNTER_MASK (0xffffff << 0) 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci/* OMAP4460.BANDGAP_THRESHOLD bits */ 12462306a36Sopenharmony_ci#define OMAP4460_T_HOT_MASK (0x3ff << 16) 12562306a36Sopenharmony_ci#define OMAP4460_T_COLD_MASK (0x3ff << 0) 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci/* OMAP4460.TSHUT_THRESHOLD bits */ 12862306a36Sopenharmony_ci#define OMAP4460_TSHUT_HOT_MASK (0x3ff << 16) 12962306a36Sopenharmony_ci#define OMAP4460_TSHUT_COLD_MASK (0x3ff << 0) 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_ci/* OMAP4460.BANDGAP_STATUS bits */ 13262306a36Sopenharmony_ci#define OMAP4460_HOT_FLAG_MASK BIT(1) 13362306a36Sopenharmony_ci#define OMAP4460_COLD_FLAG_MASK BIT(0) 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ci/** 13662306a36Sopenharmony_ci * Temperature limits and thresholds for OMAP4460 13762306a36Sopenharmony_ci * 13862306a36Sopenharmony_ci * All the macros bellow are definitions for handling the 13962306a36Sopenharmony_ci * ADC conversions and representation of temperature limits 14062306a36Sopenharmony_ci * and thresholds for OMAP4460. 14162306a36Sopenharmony_ci */ 14262306a36Sopenharmony_ci 14362306a36Sopenharmony_ci/* ADC conversion table limits */ 14462306a36Sopenharmony_ci#define OMAP4460_ADC_START_VALUE 530 14562306a36Sopenharmony_ci#define OMAP4460_ADC_END_VALUE 932 14662306a36Sopenharmony_ci/* bandgap clock limits */ 14762306a36Sopenharmony_ci#define OMAP4460_MAX_FREQ 1500000 14862306a36Sopenharmony_ci#define OMAP4460_MIN_FREQ 1000000 14962306a36Sopenharmony_ci/* interrupts thresholds */ 15062306a36Sopenharmony_ci#define OMAP4460_TSHUT_HOT 900 /* 122 deg C */ 15162306a36Sopenharmony_ci#define OMAP4460_TSHUT_COLD 895 /* 100 deg C */ 15262306a36Sopenharmony_ci#define OMAP4460_T_HOT 800 /* 73 deg C */ 15362306a36Sopenharmony_ci#define OMAP4460_T_COLD 795 /* 71 deg C */ 15462306a36Sopenharmony_ci 15562306a36Sopenharmony_ci#endif /* __OMAP4XXX_BANDGAP_H */ 156