162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * OMAP5xxx 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 __OMAP5XXX_BANDGAP_H
1062306a36Sopenharmony_ci#define __OMAP5XXX_BANDGAP_H
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci/**
1362306a36Sopenharmony_ci * *** OMAP5430 ***
1462306a36Sopenharmony_ci *
1562306a36Sopenharmony_ci * Below, in sequence, are the Register definitions,
1662306a36Sopenharmony_ci * the bitfields and the temperature definitions for OMAP5430.
1762306a36Sopenharmony_ci */
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci/**
2062306a36Sopenharmony_ci * OMAP5430 register definitions
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci * Registers are defined as offsets. The offsets are
2362306a36Sopenharmony_ci * relative to FUSE_OPP_BGAP_GPU on 5430.
2462306a36Sopenharmony_ci *
2562306a36Sopenharmony_ci * Register below are grouped by domain (not necessarily in offset order)
2662306a36Sopenharmony_ci */
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci/* OMAP5430.GPU register offsets */
2962306a36Sopenharmony_ci#define OMAP5430_FUSE_OPP_BGAP_GPU			0x0
3062306a36Sopenharmony_ci#define OMAP5430_TEMP_SENSOR_GPU_OFFSET			0x150
3162306a36Sopenharmony_ci#define OMAP5430_BGAP_THRESHOLD_GPU_OFFSET		0x1A8
3262306a36Sopenharmony_ci#define OMAP5430_BGAP_TSHUT_GPU_OFFSET			0x1B4
3362306a36Sopenharmony_ci#define OMAP5430_BGAP_DTEMP_GPU_1_OFFSET		0x1F8
3462306a36Sopenharmony_ci#define OMAP5430_BGAP_DTEMP_GPU_2_OFFSET		0x1FC
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci/* OMAP5430.MPU register offsets */
3762306a36Sopenharmony_ci#define OMAP5430_FUSE_OPP_BGAP_MPU			0x4
3862306a36Sopenharmony_ci#define OMAP5430_TEMP_SENSOR_MPU_OFFSET			0x14C
3962306a36Sopenharmony_ci#define OMAP5430_BGAP_THRESHOLD_MPU_OFFSET		0x1A4
4062306a36Sopenharmony_ci#define OMAP5430_BGAP_TSHUT_MPU_OFFSET			0x1B0
4162306a36Sopenharmony_ci#define OMAP5430_BGAP_DTEMP_MPU_1_OFFSET		0x1E4
4262306a36Sopenharmony_ci#define OMAP5430_BGAP_DTEMP_MPU_2_OFFSET		0x1E8
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci/* OMAP5430.MPU register offsets */
4562306a36Sopenharmony_ci#define OMAP5430_FUSE_OPP_BGAP_CORE			0x8
4662306a36Sopenharmony_ci#define OMAP5430_TEMP_SENSOR_CORE_OFFSET		0x154
4762306a36Sopenharmony_ci#define OMAP5430_BGAP_THRESHOLD_CORE_OFFSET		0x1AC
4862306a36Sopenharmony_ci#define OMAP5430_BGAP_TSHUT_CORE_OFFSET			0x1B8
4962306a36Sopenharmony_ci#define OMAP5430_BGAP_DTEMP_CORE_1_OFFSET		0x20C
5062306a36Sopenharmony_ci#define OMAP5430_BGAP_DTEMP_CORE_2_OFFSET		0x210
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci/* OMAP5430.common register offsets */
5362306a36Sopenharmony_ci#define OMAP5430_BGAP_CTRL_OFFSET			0x1A0
5462306a36Sopenharmony_ci#define OMAP5430_BGAP_STATUS_OFFSET			0x1C8
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci/**
5762306a36Sopenharmony_ci * Register bitfields for OMAP5430
5862306a36Sopenharmony_ci *
5962306a36Sopenharmony_ci * All the macros bellow define the required bits for
6062306a36Sopenharmony_ci * controlling temperature on OMAP5430. Bit defines are
6162306a36Sopenharmony_ci * grouped by register.
6262306a36Sopenharmony_ci */
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci/* OMAP5430.TEMP_SENSOR */
6562306a36Sopenharmony_ci#define OMAP5430_BGAP_TEMP_SENSOR_SOC_MASK		BIT(12)
6662306a36Sopenharmony_ci#define OMAP5430_BGAP_TEMPSOFF_MASK			BIT(11)
6762306a36Sopenharmony_ci#define OMAP5430_BGAP_TEMP_SENSOR_EOCZ_MASK		BIT(10)
6862306a36Sopenharmony_ci#define OMAP5430_BGAP_TEMP_SENSOR_DTEMP_MASK		(0x3ff << 0)
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci/* OMAP5430.BANDGAP_CTRL */
7162306a36Sopenharmony_ci#define OMAP5430_MASK_COUNTER_DELAY_MASK		(0x7 << 27)
7262306a36Sopenharmony_ci#define OMAP5430_MASK_FREEZE_CORE_MASK			BIT(23)
7362306a36Sopenharmony_ci#define OMAP5430_MASK_FREEZE_GPU_MASK			BIT(22)
7462306a36Sopenharmony_ci#define OMAP5430_MASK_FREEZE_MPU_MASK			BIT(21)
7562306a36Sopenharmony_ci#define OMAP5430_MASK_HOT_CORE_MASK			BIT(5)
7662306a36Sopenharmony_ci#define OMAP5430_MASK_COLD_CORE_MASK			BIT(4)
7762306a36Sopenharmony_ci#define OMAP5430_MASK_HOT_GPU_MASK			BIT(3)
7862306a36Sopenharmony_ci#define OMAP5430_MASK_COLD_GPU_MASK			BIT(2)
7962306a36Sopenharmony_ci#define OMAP5430_MASK_HOT_MPU_MASK			BIT(1)
8062306a36Sopenharmony_ci#define OMAP5430_MASK_COLD_MPU_MASK			BIT(0)
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci/* OMAP5430.BANDGAP_COUNTER */
8362306a36Sopenharmony_ci#define OMAP5430_COUNTER_MASK				(0xffffff << 0)
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci/* OMAP5430.BANDGAP_THRESHOLD */
8662306a36Sopenharmony_ci#define OMAP5430_T_HOT_MASK				(0x3ff << 16)
8762306a36Sopenharmony_ci#define OMAP5430_T_COLD_MASK				(0x3ff << 0)
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci/* OMAP5430.TSHUT_THRESHOLD */
9062306a36Sopenharmony_ci#define OMAP5430_TSHUT_HOT_MASK				(0x3ff << 16)
9162306a36Sopenharmony_ci#define OMAP5430_TSHUT_COLD_MASK			(0x3ff << 0)
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci/* OMAP5430.BANDGAP_STATUS */
9462306a36Sopenharmony_ci#define OMAP5430_HOT_CORE_FLAG_MASK			BIT(5)
9562306a36Sopenharmony_ci#define OMAP5430_COLD_CORE_FLAG_MASK			BIT(4)
9662306a36Sopenharmony_ci#define OMAP5430_HOT_GPU_FLAG_MASK			BIT(3)
9762306a36Sopenharmony_ci#define OMAP5430_COLD_GPU_FLAG_MASK			BIT(2)
9862306a36Sopenharmony_ci#define OMAP5430_HOT_MPU_FLAG_MASK			BIT(1)
9962306a36Sopenharmony_ci#define OMAP5430_COLD_MPU_FLAG_MASK			BIT(0)
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci/**
10262306a36Sopenharmony_ci * Temperature limits and thresholds for OMAP5430
10362306a36Sopenharmony_ci *
10462306a36Sopenharmony_ci * All the macros bellow are definitions for handling the
10562306a36Sopenharmony_ci * ADC conversions and representation of temperature limits
10662306a36Sopenharmony_ci * and thresholds for OMAP5430. Definitions are grouped
10762306a36Sopenharmony_ci * by temperature domain.
10862306a36Sopenharmony_ci */
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ci/* OMAP5430.common temperature definitions */
11162306a36Sopenharmony_ci/* ADC conversion table limits */
11262306a36Sopenharmony_ci#define OMAP5430_ADC_START_VALUE			540
11362306a36Sopenharmony_ci#define OMAP5430_ADC_END_VALUE				945
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci/* OMAP5430.GPU temperature definitions */
11662306a36Sopenharmony_ci/* bandgap clock limits */
11762306a36Sopenharmony_ci#define OMAP5430_GPU_MAX_FREQ				1500000
11862306a36Sopenharmony_ci#define OMAP5430_GPU_MIN_FREQ				1000000
11962306a36Sopenharmony_ci/* interrupts thresholds */
12062306a36Sopenharmony_ci#define OMAP5430_GPU_TSHUT_HOT				915
12162306a36Sopenharmony_ci#define OMAP5430_GPU_TSHUT_COLD				900
12262306a36Sopenharmony_ci#define OMAP5430_GPU_T_HOT				800
12362306a36Sopenharmony_ci#define OMAP5430_GPU_T_COLD				795
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci/* OMAP5430.MPU temperature definitions */
12662306a36Sopenharmony_ci/* bandgap clock limits */
12762306a36Sopenharmony_ci#define OMAP5430_MPU_MAX_FREQ				1500000
12862306a36Sopenharmony_ci#define OMAP5430_MPU_MIN_FREQ				1000000
12962306a36Sopenharmony_ci/* interrupts thresholds */
13062306a36Sopenharmony_ci#define OMAP5430_MPU_TSHUT_HOT				915
13162306a36Sopenharmony_ci#define OMAP5430_MPU_TSHUT_COLD				900
13262306a36Sopenharmony_ci#define OMAP5430_MPU_T_HOT				800
13362306a36Sopenharmony_ci#define OMAP5430_MPU_T_COLD				795
13462306a36Sopenharmony_ci
13562306a36Sopenharmony_ci/* OMAP5430.CORE temperature definitions */
13662306a36Sopenharmony_ci/* bandgap clock limits */
13762306a36Sopenharmony_ci#define OMAP5430_CORE_MAX_FREQ				1500000
13862306a36Sopenharmony_ci#define OMAP5430_CORE_MIN_FREQ				1000000
13962306a36Sopenharmony_ci/* interrupts thresholds */
14062306a36Sopenharmony_ci#define OMAP5430_CORE_TSHUT_HOT				915
14162306a36Sopenharmony_ci#define OMAP5430_CORE_TSHUT_COLD			900
14262306a36Sopenharmony_ci#define OMAP5430_CORE_T_HOT				800
14362306a36Sopenharmony_ci#define OMAP5430_CORE_T_COLD				795
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci#endif /* __OMAP5XXX_BANDGAP_H */
146