18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Defines for the EMIF driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2012 Texas Instruments, Inc.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Benoit Cousson (b-cousson@ti.com)
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci#ifndef __EMIF_H
108c2ecf20Sopenharmony_ci#define __EMIF_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/*
138c2ecf20Sopenharmony_ci * Maximum number of different frequencies supported by EMIF driver
148c2ecf20Sopenharmony_ci * Determines the number of entries in the pointer array for register
158c2ecf20Sopenharmony_ci * cache
168c2ecf20Sopenharmony_ci */
178c2ecf20Sopenharmony_ci#define EMIF_MAX_NUM_FREQUENCIES			6
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/* State of the core voltage */
208c2ecf20Sopenharmony_ci#define DDR_VOLTAGE_STABLE				0
218c2ecf20Sopenharmony_ci#define DDR_VOLTAGE_RAMPING				1
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci/* Defines for timing De-rating */
248c2ecf20Sopenharmony_ci#define EMIF_NORMAL_TIMINGS				0
258c2ecf20Sopenharmony_ci#define EMIF_DERATED_TIMINGS				1
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/* Length of the forced read idle period in terms of cycles */
288c2ecf20Sopenharmony_ci#define EMIF_READ_IDLE_LEN_VAL				5
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/*
318c2ecf20Sopenharmony_ci * forced read idle interval to be used when voltage
328c2ecf20Sopenharmony_ci * is changed as part of DVFS/DPS - 1ms
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_ci#define READ_IDLE_INTERVAL_DVFS				(1*1000000)
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/*
378c2ecf20Sopenharmony_ci * Forced read idle interval to be used when voltage is stable
388c2ecf20Sopenharmony_ci * 50us - or maximum value will do
398c2ecf20Sopenharmony_ci */
408c2ecf20Sopenharmony_ci#define READ_IDLE_INTERVAL_NORMAL			(50*1000000)
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci/* DLL calibration interval when voltage is NOT stable - 1us */
438c2ecf20Sopenharmony_ci#define DLL_CALIB_INTERVAL_DVFS				(1*1000000)
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define DLL_CALIB_ACK_WAIT_VAL				5
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/* Interval between ZQCS commands - hw team recommended value */
488c2ecf20Sopenharmony_ci#define EMIF_ZQCS_INTERVAL_US				(50*1000)
498c2ecf20Sopenharmony_ci/* Enable ZQ Calibration on exiting Self-refresh */
508c2ecf20Sopenharmony_ci#define ZQ_SFEXITEN_ENABLE				1
518c2ecf20Sopenharmony_ci/*
528c2ecf20Sopenharmony_ci * ZQ Calibration simultaneously on both chip-selects:
538c2ecf20Sopenharmony_ci * Needs one calibration resistor per CS
548c2ecf20Sopenharmony_ci */
558c2ecf20Sopenharmony_ci#define	ZQ_DUALCALEN_DISABLE				0
568c2ecf20Sopenharmony_ci#define	ZQ_DUALCALEN_ENABLE				1
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci#define T_ZQCS_DEFAULT_NS				90
598c2ecf20Sopenharmony_ci#define T_ZQCL_DEFAULT_NS				360
608c2ecf20Sopenharmony_ci#define T_ZQINIT_DEFAULT_NS				1000
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci/* DPD_EN */
638c2ecf20Sopenharmony_ci#define DPD_DISABLE					0
648c2ecf20Sopenharmony_ci#define DPD_ENABLE					1
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci/*
678c2ecf20Sopenharmony_ci * Default values for the low-power entry to be used if not provided by user.
688c2ecf20Sopenharmony_ci * OMAP4/5 has a hw bug(i735) due to which this value can not be less than 512
698c2ecf20Sopenharmony_ci * Timeout values are in DDR clock 'cycles' and frequency threshold in Hz
708c2ecf20Sopenharmony_ci */
718c2ecf20Sopenharmony_ci#define EMIF_LP_MODE_TIMEOUT_PERFORMANCE		2048
728c2ecf20Sopenharmony_ci#define EMIF_LP_MODE_TIMEOUT_POWER			512
738c2ecf20Sopenharmony_ci#define EMIF_LP_MODE_FREQ_THRESHOLD			400000000
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci/* DDR_PHY_CTRL_1 values for EMIF4D - ATTILA PHY combination */
768c2ecf20Sopenharmony_ci#define EMIF_DDR_PHY_CTRL_1_BASE_VAL_ATTILAPHY		0x049FF000
778c2ecf20Sopenharmony_ci#define EMIF_DLL_SLAVE_DLY_CTRL_400_MHZ_ATTILAPHY	0x41
788c2ecf20Sopenharmony_ci#define EMIF_DLL_SLAVE_DLY_CTRL_200_MHZ_ATTILAPHY	0x80
798c2ecf20Sopenharmony_ci#define EMIF_DLL_SLAVE_DLY_CTRL_100_MHZ_AND_LESS_ATTILAPHY 0xFF
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci/* DDR_PHY_CTRL_1 values for EMIF4D5 INTELLIPHY combination */
828c2ecf20Sopenharmony_ci#define EMIF_DDR_PHY_CTRL_1_BASE_VAL_INTELLIPHY		0x0E084200
838c2ecf20Sopenharmony_ci#define EMIF_PHY_TOTAL_READ_LATENCY_INTELLIPHY_PS	10000
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci/* TEMP_ALERT_CONFIG - corresponding to temp gradient 5 C/s */
868c2ecf20Sopenharmony_ci#define TEMP_ALERT_POLL_INTERVAL_DEFAULT_MS		360
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci#define EMIF_T_CSTA					3
898c2ecf20Sopenharmony_ci#define EMIF_T_PDLL_UL					128
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci/* External PHY control registers magic values */
928c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_1_VAL				0x04020080
938c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_5_VAL				0x04010040
948c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_6_VAL				0x01004010
958c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_7_VAL				0x00001004
968c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_8_VAL				0x04010040
978c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_9_VAL				0x01004010
988c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_10_VAL			0x00001004
998c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_11_VAL			0x00000000
1008c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_12_VAL			0x00000000
1018c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_13_VAL			0x00000000
1028c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_14_VAL			0x80080080
1038c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_15_VAL			0x00800800
1048c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_16_VAL			0x08102040
1058c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_17_VAL			0x00000001
1068c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_18_VAL			0x540A8150
1078c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_19_VAL			0xA81502A0
1088c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_20_VAL			0x002A0540
1098c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_21_VAL			0x00000000
1108c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_22_VAL			0x00000000
1118c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_23_VAL			0x00000000
1128c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_24_VAL			0x00000077
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci#define EMIF_INTELLI_PHY_DQS_GATE_OPENING_DELAY_PS	1200
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci/* Registers offset */
1178c2ecf20Sopenharmony_ci#define EMIF_MODULE_ID_AND_REVISION			0x0000
1188c2ecf20Sopenharmony_ci#define EMIF_STATUS					0x0004
1198c2ecf20Sopenharmony_ci#define EMIF_SDRAM_CONFIG				0x0008
1208c2ecf20Sopenharmony_ci#define EMIF_SDRAM_CONFIG_2				0x000c
1218c2ecf20Sopenharmony_ci#define EMIF_SDRAM_REFRESH_CONTROL			0x0010
1228c2ecf20Sopenharmony_ci#define EMIF_SDRAM_REFRESH_CTRL_SHDW			0x0014
1238c2ecf20Sopenharmony_ci#define EMIF_SDRAM_TIMING_1				0x0018
1248c2ecf20Sopenharmony_ci#define EMIF_SDRAM_TIMING_1_SHDW			0x001c
1258c2ecf20Sopenharmony_ci#define EMIF_SDRAM_TIMING_2				0x0020
1268c2ecf20Sopenharmony_ci#define EMIF_SDRAM_TIMING_2_SHDW			0x0024
1278c2ecf20Sopenharmony_ci#define EMIF_SDRAM_TIMING_3				0x0028
1288c2ecf20Sopenharmony_ci#define EMIF_SDRAM_TIMING_3_SHDW			0x002c
1298c2ecf20Sopenharmony_ci#define EMIF_LPDDR2_NVM_TIMING				0x0030
1308c2ecf20Sopenharmony_ci#define EMIF_LPDDR2_NVM_TIMING_SHDW			0x0034
1318c2ecf20Sopenharmony_ci#define EMIF_POWER_MANAGEMENT_CONTROL			0x0038
1328c2ecf20Sopenharmony_ci#define EMIF_POWER_MANAGEMENT_CTRL_SHDW			0x003c
1338c2ecf20Sopenharmony_ci#define EMIF_LPDDR2_MODE_REG_DATA			0x0040
1348c2ecf20Sopenharmony_ci#define EMIF_LPDDR2_MODE_REG_CONFIG			0x0050
1358c2ecf20Sopenharmony_ci#define EMIF_OCP_CONFIG					0x0054
1368c2ecf20Sopenharmony_ci#define EMIF_OCP_CONFIG_VALUE_1				0x0058
1378c2ecf20Sopenharmony_ci#define EMIF_OCP_CONFIG_VALUE_2				0x005c
1388c2ecf20Sopenharmony_ci#define EMIF_IODFT_TEST_LOGIC_GLOBAL_CONTROL		0x0060
1398c2ecf20Sopenharmony_ci#define EMIF_IODFT_TEST_LOGIC_CTRL_MISR_RESULT		0x0064
1408c2ecf20Sopenharmony_ci#define EMIF_IODFT_TEST_LOGIC_ADDRESS_MISR_RESULT	0x0068
1418c2ecf20Sopenharmony_ci#define EMIF_IODFT_TEST_LOGIC_DATA_MISR_RESULT_1	0x006c
1428c2ecf20Sopenharmony_ci#define EMIF_IODFT_TEST_LOGIC_DATA_MISR_RESULT_2	0x0070
1438c2ecf20Sopenharmony_ci#define EMIF_IODFT_TEST_LOGIC_DATA_MISR_RESULT_3	0x0074
1448c2ecf20Sopenharmony_ci#define EMIF_PERFORMANCE_COUNTER_1			0x0080
1458c2ecf20Sopenharmony_ci#define EMIF_PERFORMANCE_COUNTER_2			0x0084
1468c2ecf20Sopenharmony_ci#define EMIF_PERFORMANCE_COUNTER_CONFIG			0x0088
1478c2ecf20Sopenharmony_ci#define EMIF_PERFORMANCE_COUNTER_MASTER_REGION_SELECT	0x008c
1488c2ecf20Sopenharmony_ci#define EMIF_PERFORMANCE_COUNTER_TIME			0x0090
1498c2ecf20Sopenharmony_ci#define EMIF_MISC_REG					0x0094
1508c2ecf20Sopenharmony_ci#define EMIF_DLL_CALIB_CTRL				0x0098
1518c2ecf20Sopenharmony_ci#define EMIF_DLL_CALIB_CTRL_SHDW			0x009c
1528c2ecf20Sopenharmony_ci#define EMIF_END_OF_INTERRUPT				0x00a0
1538c2ecf20Sopenharmony_ci#define EMIF_SYSTEM_OCP_INTERRUPT_RAW_STATUS		0x00a4
1548c2ecf20Sopenharmony_ci#define EMIF_LL_OCP_INTERRUPT_RAW_STATUS		0x00a8
1558c2ecf20Sopenharmony_ci#define EMIF_SYSTEM_OCP_INTERRUPT_STATUS		0x00ac
1568c2ecf20Sopenharmony_ci#define EMIF_LL_OCP_INTERRUPT_STATUS			0x00b0
1578c2ecf20Sopenharmony_ci#define EMIF_SYSTEM_OCP_INTERRUPT_ENABLE_SET		0x00b4
1588c2ecf20Sopenharmony_ci#define EMIF_LL_OCP_INTERRUPT_ENABLE_SET		0x00b8
1598c2ecf20Sopenharmony_ci#define EMIF_SYSTEM_OCP_INTERRUPT_ENABLE_CLEAR		0x00bc
1608c2ecf20Sopenharmony_ci#define EMIF_LL_OCP_INTERRUPT_ENABLE_CLEAR		0x00c0
1618c2ecf20Sopenharmony_ci#define EMIF_SDRAM_OUTPUT_IMPEDANCE_CALIBRATION_CONFIG	0x00c8
1628c2ecf20Sopenharmony_ci#define EMIF_TEMPERATURE_ALERT_CONFIG			0x00cc
1638c2ecf20Sopenharmony_ci#define EMIF_OCP_ERROR_LOG				0x00d0
1648c2ecf20Sopenharmony_ci#define EMIF_READ_WRITE_LEVELING_RAMP_WINDOW		0x00d4
1658c2ecf20Sopenharmony_ci#define EMIF_READ_WRITE_LEVELING_RAMP_CONTROL		0x00d8
1668c2ecf20Sopenharmony_ci#define EMIF_READ_WRITE_LEVELING_CONTROL		0x00dc
1678c2ecf20Sopenharmony_ci#define EMIF_DDR_PHY_CTRL_1				0x00e4
1688c2ecf20Sopenharmony_ci#define EMIF_DDR_PHY_CTRL_1_SHDW			0x00e8
1698c2ecf20Sopenharmony_ci#define EMIF_DDR_PHY_CTRL_2				0x00ec
1708c2ecf20Sopenharmony_ci#define EMIF_PRIORITY_TO_CLASS_OF_SERVICE_MAPPING	0x0100
1718c2ecf20Sopenharmony_ci#define EMIF_CONNECTION_ID_TO_CLASS_OF_SERVICE_1_MAPPING 0x0104
1728c2ecf20Sopenharmony_ci#define EMIF_CONNECTION_ID_TO_CLASS_OF_SERVICE_2_MAPPING 0x0108
1738c2ecf20Sopenharmony_ci#define EMIF_READ_WRITE_EXECUTION_THRESHOLD		0x0120
1748c2ecf20Sopenharmony_ci#define EMIF_COS_CONFIG					0x0124
1758c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_1				0x0140
1768c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_2				0x0144
1778c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_3				0x0148
1788c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_4				0x014c
1798c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_5				0x0150
1808c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_6				0x0154
1818c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_7				0x0158
1828c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_8				0x015c
1838c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_9				0x0160
1848c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_10				0x0164
1858c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_11				0x0168
1868c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_12				0x016c
1878c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_13				0x0170
1888c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_14				0x0174
1898c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_15				0x0178
1908c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_16				0x017c
1918c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_17				0x0180
1928c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_18				0x0184
1938c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_19				0x0188
1948c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_20				0x018c
1958c2ecf20Sopenharmony_ci#define EMIF_PHY_STATUS_21				0x0190
1968c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_1				0x0200
1978c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_1_SHDW			0x0204
1988c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_2				0x0208
1998c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_2_SHDW			0x020c
2008c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_3				0x0210
2018c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_3_SHDW			0x0214
2028c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_4				0x0218
2038c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_4_SHDW			0x021c
2048c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_5				0x0220
2058c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_5_SHDW			0x0224
2068c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_6				0x0228
2078c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_6_SHDW			0x022c
2088c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_7				0x0230
2098c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_7_SHDW			0x0234
2108c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_8				0x0238
2118c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_8_SHDW			0x023c
2128c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_9				0x0240
2138c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_9_SHDW			0x0244
2148c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_10				0x0248
2158c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_10_SHDW			0x024c
2168c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_11				0x0250
2178c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_11_SHDW			0x0254
2188c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_12				0x0258
2198c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_12_SHDW			0x025c
2208c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_13				0x0260
2218c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_13_SHDW			0x0264
2228c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_14				0x0268
2238c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_14_SHDW			0x026c
2248c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_15				0x0270
2258c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_15_SHDW			0x0274
2268c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_16				0x0278
2278c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_16_SHDW			0x027c
2288c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_17				0x0280
2298c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_17_SHDW			0x0284
2308c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_18				0x0288
2318c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_18_SHDW			0x028c
2328c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_19				0x0290
2338c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_19_SHDW			0x0294
2348c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_20				0x0298
2358c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_20_SHDW			0x029c
2368c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_21				0x02a0
2378c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_21_SHDW			0x02a4
2388c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_22				0x02a8
2398c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_22_SHDW			0x02ac
2408c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_23				0x02b0
2418c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_23_SHDW			0x02b4
2428c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_24				0x02b8
2438c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_24_SHDW			0x02bc
2448c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_25				0x02c0
2458c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_25_SHDW			0x02c4
2468c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_26				0x02c8
2478c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_26_SHDW			0x02cc
2488c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_27				0x02d0
2498c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_27_SHDW			0x02d4
2508c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_28				0x02d8
2518c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_28_SHDW			0x02dc
2528c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_29				0x02e0
2538c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_29_SHDW			0x02e4
2548c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_30				0x02e8
2558c2ecf20Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_30_SHDW			0x02ec
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci/* Registers shifts and masks */
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci/* EMIF_MODULE_ID_AND_REVISION */
2608c2ecf20Sopenharmony_ci#define SCHEME_SHIFT					30
2618c2ecf20Sopenharmony_ci#define SCHEME_MASK					(0x3 << 30)
2628c2ecf20Sopenharmony_ci#define MODULE_ID_SHIFT					16
2638c2ecf20Sopenharmony_ci#define MODULE_ID_MASK					(0xfff << 16)
2648c2ecf20Sopenharmony_ci#define RTL_VERSION_SHIFT				11
2658c2ecf20Sopenharmony_ci#define RTL_VERSION_MASK				(0x1f << 11)
2668c2ecf20Sopenharmony_ci#define MAJOR_REVISION_SHIFT				8
2678c2ecf20Sopenharmony_ci#define MAJOR_REVISION_MASK				(0x7 << 8)
2688c2ecf20Sopenharmony_ci#define MINOR_REVISION_SHIFT				0
2698c2ecf20Sopenharmony_ci#define MINOR_REVISION_MASK				(0x3f << 0)
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci/* STATUS */
2728c2ecf20Sopenharmony_ci#define BE_SHIFT					31
2738c2ecf20Sopenharmony_ci#define BE_MASK						(1 << 31)
2748c2ecf20Sopenharmony_ci#define DUAL_CLK_MODE_SHIFT				30
2758c2ecf20Sopenharmony_ci#define DUAL_CLK_MODE_MASK				(1 << 30)
2768c2ecf20Sopenharmony_ci#define FAST_INIT_SHIFT					29
2778c2ecf20Sopenharmony_ci#define FAST_INIT_MASK					(1 << 29)
2788c2ecf20Sopenharmony_ci#define RDLVLGATETO_SHIFT				6
2798c2ecf20Sopenharmony_ci#define RDLVLGATETO_MASK				(1 << 6)
2808c2ecf20Sopenharmony_ci#define RDLVLTO_SHIFT					5
2818c2ecf20Sopenharmony_ci#define RDLVLTO_MASK					(1 << 5)
2828c2ecf20Sopenharmony_ci#define WRLVLTO_SHIFT					4
2838c2ecf20Sopenharmony_ci#define WRLVLTO_MASK					(1 << 4)
2848c2ecf20Sopenharmony_ci#define PHY_DLL_READY_SHIFT				2
2858c2ecf20Sopenharmony_ci#define PHY_DLL_READY_MASK				(1 << 2)
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci/* SDRAM_CONFIG */
2888c2ecf20Sopenharmony_ci#define SDRAM_TYPE_SHIFT				29
2898c2ecf20Sopenharmony_ci#define SDRAM_TYPE_MASK					(0x7 << 29)
2908c2ecf20Sopenharmony_ci#define IBANK_POS_SHIFT					27
2918c2ecf20Sopenharmony_ci#define IBANK_POS_MASK					(0x3 << 27)
2928c2ecf20Sopenharmony_ci#define DDR_TERM_SHIFT					24
2938c2ecf20Sopenharmony_ci#define DDR_TERM_MASK					(0x7 << 24)
2948c2ecf20Sopenharmony_ci#define DDR2_DDQS_SHIFT					23
2958c2ecf20Sopenharmony_ci#define DDR2_DDQS_MASK					(1 << 23)
2968c2ecf20Sopenharmony_ci#define DYN_ODT_SHIFT					21
2978c2ecf20Sopenharmony_ci#define DYN_ODT_MASK					(0x3 << 21)
2988c2ecf20Sopenharmony_ci#define DDR_DISABLE_DLL_SHIFT				20
2998c2ecf20Sopenharmony_ci#define DDR_DISABLE_DLL_MASK				(1 << 20)
3008c2ecf20Sopenharmony_ci#define SDRAM_DRIVE_SHIFT				18
3018c2ecf20Sopenharmony_ci#define SDRAM_DRIVE_MASK				(0x3 << 18)
3028c2ecf20Sopenharmony_ci#define CWL_SHIFT					16
3038c2ecf20Sopenharmony_ci#define CWL_MASK					(0x3 << 16)
3048c2ecf20Sopenharmony_ci#define NARROW_MODE_SHIFT				14
3058c2ecf20Sopenharmony_ci#define NARROW_MODE_MASK				(0x3 << 14)
3068c2ecf20Sopenharmony_ci#define CL_SHIFT					10
3078c2ecf20Sopenharmony_ci#define CL_MASK						(0xf << 10)
3088c2ecf20Sopenharmony_ci#define ROWSIZE_SHIFT					7
3098c2ecf20Sopenharmony_ci#define ROWSIZE_MASK					(0x7 << 7)
3108c2ecf20Sopenharmony_ci#define IBANK_SHIFT					4
3118c2ecf20Sopenharmony_ci#define IBANK_MASK					(0x7 << 4)
3128c2ecf20Sopenharmony_ci#define EBANK_SHIFT					3
3138c2ecf20Sopenharmony_ci#define EBANK_MASK					(1 << 3)
3148c2ecf20Sopenharmony_ci#define PAGESIZE_SHIFT					0
3158c2ecf20Sopenharmony_ci#define PAGESIZE_MASK					(0x7 << 0)
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci/* SDRAM_CONFIG_2 */
3188c2ecf20Sopenharmony_ci#define CS1NVMEN_SHIFT					30
3198c2ecf20Sopenharmony_ci#define CS1NVMEN_MASK					(1 << 30)
3208c2ecf20Sopenharmony_ci#define EBANK_POS_SHIFT					27
3218c2ecf20Sopenharmony_ci#define EBANK_POS_MASK					(1 << 27)
3228c2ecf20Sopenharmony_ci#define RDBNUM_SHIFT					4
3238c2ecf20Sopenharmony_ci#define RDBNUM_MASK					(0x3 << 4)
3248c2ecf20Sopenharmony_ci#define RDBSIZE_SHIFT					0
3258c2ecf20Sopenharmony_ci#define RDBSIZE_MASK					(0x7 << 0)
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ci/* SDRAM_REFRESH_CONTROL */
3288c2ecf20Sopenharmony_ci#define INITREF_DIS_SHIFT				31
3298c2ecf20Sopenharmony_ci#define INITREF_DIS_MASK				(1 << 31)
3308c2ecf20Sopenharmony_ci#define SRT_SHIFT					29
3318c2ecf20Sopenharmony_ci#define SRT_MASK					(1 << 29)
3328c2ecf20Sopenharmony_ci#define ASR_SHIFT					28
3338c2ecf20Sopenharmony_ci#define ASR_MASK					(1 << 28)
3348c2ecf20Sopenharmony_ci#define PASR_SHIFT					24
3358c2ecf20Sopenharmony_ci#define PASR_MASK					(0x7 << 24)
3368c2ecf20Sopenharmony_ci#define REFRESH_RATE_SHIFT				0
3378c2ecf20Sopenharmony_ci#define REFRESH_RATE_MASK				(0xffff << 0)
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci/* SDRAM_TIMING_1 */
3408c2ecf20Sopenharmony_ci#define T_RTW_SHIFT					29
3418c2ecf20Sopenharmony_ci#define T_RTW_MASK					(0x7 << 29)
3428c2ecf20Sopenharmony_ci#define T_RP_SHIFT					25
3438c2ecf20Sopenharmony_ci#define T_RP_MASK					(0xf << 25)
3448c2ecf20Sopenharmony_ci#define T_RCD_SHIFT					21
3458c2ecf20Sopenharmony_ci#define T_RCD_MASK					(0xf << 21)
3468c2ecf20Sopenharmony_ci#define T_WR_SHIFT					17
3478c2ecf20Sopenharmony_ci#define T_WR_MASK					(0xf << 17)
3488c2ecf20Sopenharmony_ci#define T_RAS_SHIFT					12
3498c2ecf20Sopenharmony_ci#define T_RAS_MASK					(0x1f << 12)
3508c2ecf20Sopenharmony_ci#define T_RC_SHIFT					6
3518c2ecf20Sopenharmony_ci#define T_RC_MASK					(0x3f << 6)
3528c2ecf20Sopenharmony_ci#define T_RRD_SHIFT					3
3538c2ecf20Sopenharmony_ci#define T_RRD_MASK					(0x7 << 3)
3548c2ecf20Sopenharmony_ci#define T_WTR_SHIFT					0
3558c2ecf20Sopenharmony_ci#define T_WTR_MASK					(0x7 << 0)
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_ci/* SDRAM_TIMING_2 */
3588c2ecf20Sopenharmony_ci#define T_XP_SHIFT					28
3598c2ecf20Sopenharmony_ci#define T_XP_MASK					(0x7 << 28)
3608c2ecf20Sopenharmony_ci#define T_ODT_SHIFT					25
3618c2ecf20Sopenharmony_ci#define T_ODT_MASK					(0x7 << 25)
3628c2ecf20Sopenharmony_ci#define T_XSNR_SHIFT					16
3638c2ecf20Sopenharmony_ci#define T_XSNR_MASK					(0x1ff << 16)
3648c2ecf20Sopenharmony_ci#define T_XSRD_SHIFT					6
3658c2ecf20Sopenharmony_ci#define T_XSRD_MASK					(0x3ff << 6)
3668c2ecf20Sopenharmony_ci#define T_RTP_SHIFT					3
3678c2ecf20Sopenharmony_ci#define T_RTP_MASK					(0x7 << 3)
3688c2ecf20Sopenharmony_ci#define T_CKE_SHIFT					0
3698c2ecf20Sopenharmony_ci#define T_CKE_MASK					(0x7 << 0)
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ci/* SDRAM_TIMING_3 */
3728c2ecf20Sopenharmony_ci#define T_PDLL_UL_SHIFT					28
3738c2ecf20Sopenharmony_ci#define T_PDLL_UL_MASK					(0xf << 28)
3748c2ecf20Sopenharmony_ci#define T_CSTA_SHIFT					24
3758c2ecf20Sopenharmony_ci#define T_CSTA_MASK					(0xf << 24)
3768c2ecf20Sopenharmony_ci#define T_CKESR_SHIFT					21
3778c2ecf20Sopenharmony_ci#define T_CKESR_MASK					(0x7 << 21)
3788c2ecf20Sopenharmony_ci#define ZQ_ZQCS_SHIFT					15
3798c2ecf20Sopenharmony_ci#define ZQ_ZQCS_MASK					(0x3f << 15)
3808c2ecf20Sopenharmony_ci#define T_TDQSCKMAX_SHIFT				13
3818c2ecf20Sopenharmony_ci#define T_TDQSCKMAX_MASK				(0x3 << 13)
3828c2ecf20Sopenharmony_ci#define T_RFC_SHIFT					4
3838c2ecf20Sopenharmony_ci#define T_RFC_MASK					(0x1ff << 4)
3848c2ecf20Sopenharmony_ci#define T_RAS_MAX_SHIFT					0
3858c2ecf20Sopenharmony_ci#define T_RAS_MAX_MASK					(0xf << 0)
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_ci/* POWER_MANAGEMENT_CONTROL */
3888c2ecf20Sopenharmony_ci#define PD_TIM_SHIFT					12
3898c2ecf20Sopenharmony_ci#define PD_TIM_MASK					(0xf << 12)
3908c2ecf20Sopenharmony_ci#define DPD_EN_SHIFT					11
3918c2ecf20Sopenharmony_ci#define DPD_EN_MASK					(1 << 11)
3928c2ecf20Sopenharmony_ci#define LP_MODE_SHIFT					8
3938c2ecf20Sopenharmony_ci#define LP_MODE_MASK					(0x7 << 8)
3948c2ecf20Sopenharmony_ci#define SR_TIM_SHIFT					4
3958c2ecf20Sopenharmony_ci#define SR_TIM_MASK					(0xf << 4)
3968c2ecf20Sopenharmony_ci#define CS_TIM_SHIFT					0
3978c2ecf20Sopenharmony_ci#define CS_TIM_MASK					(0xf << 0)
3988c2ecf20Sopenharmony_ci
3998c2ecf20Sopenharmony_ci/* LPDDR2_MODE_REG_DATA */
4008c2ecf20Sopenharmony_ci#define VALUE_0_SHIFT					0
4018c2ecf20Sopenharmony_ci#define VALUE_0_MASK					(0x7f << 0)
4028c2ecf20Sopenharmony_ci
4038c2ecf20Sopenharmony_ci/* LPDDR2_MODE_REG_CONFIG */
4048c2ecf20Sopenharmony_ci#define CS_SHIFT					31
4058c2ecf20Sopenharmony_ci#define CS_MASK						(1 << 31)
4068c2ecf20Sopenharmony_ci#define REFRESH_EN_SHIFT				30
4078c2ecf20Sopenharmony_ci#define REFRESH_EN_MASK					(1 << 30)
4088c2ecf20Sopenharmony_ci#define ADDRESS_SHIFT					0
4098c2ecf20Sopenharmony_ci#define ADDRESS_MASK					(0xff << 0)
4108c2ecf20Sopenharmony_ci
4118c2ecf20Sopenharmony_ci/* OCP_CONFIG */
4128c2ecf20Sopenharmony_ci#define SYS_THRESH_MAX_SHIFT				24
4138c2ecf20Sopenharmony_ci#define SYS_THRESH_MAX_MASK				(0xf << 24)
4148c2ecf20Sopenharmony_ci#define MPU_THRESH_MAX_SHIFT				20
4158c2ecf20Sopenharmony_ci#define MPU_THRESH_MAX_MASK				(0xf << 20)
4168c2ecf20Sopenharmony_ci#define LL_THRESH_MAX_SHIFT				16
4178c2ecf20Sopenharmony_ci#define LL_THRESH_MAX_MASK				(0xf << 16)
4188c2ecf20Sopenharmony_ci
4198c2ecf20Sopenharmony_ci/* PERFORMANCE_COUNTER_1 */
4208c2ecf20Sopenharmony_ci#define COUNTER1_SHIFT					0
4218c2ecf20Sopenharmony_ci#define COUNTER1_MASK					(0xffffffff << 0)
4228c2ecf20Sopenharmony_ci
4238c2ecf20Sopenharmony_ci/* PERFORMANCE_COUNTER_2 */
4248c2ecf20Sopenharmony_ci#define COUNTER2_SHIFT					0
4258c2ecf20Sopenharmony_ci#define COUNTER2_MASK					(0xffffffff << 0)
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_ci/* PERFORMANCE_COUNTER_CONFIG */
4288c2ecf20Sopenharmony_ci#define CNTR2_MCONNID_EN_SHIFT				31
4298c2ecf20Sopenharmony_ci#define CNTR2_MCONNID_EN_MASK				(1 << 31)
4308c2ecf20Sopenharmony_ci#define CNTR2_REGION_EN_SHIFT				30
4318c2ecf20Sopenharmony_ci#define CNTR2_REGION_EN_MASK				(1 << 30)
4328c2ecf20Sopenharmony_ci#define CNTR2_CFG_SHIFT					16
4338c2ecf20Sopenharmony_ci#define CNTR2_CFG_MASK					(0xf << 16)
4348c2ecf20Sopenharmony_ci#define CNTR1_MCONNID_EN_SHIFT				15
4358c2ecf20Sopenharmony_ci#define CNTR1_MCONNID_EN_MASK				(1 << 15)
4368c2ecf20Sopenharmony_ci#define CNTR1_REGION_EN_SHIFT				14
4378c2ecf20Sopenharmony_ci#define CNTR1_REGION_EN_MASK				(1 << 14)
4388c2ecf20Sopenharmony_ci#define CNTR1_CFG_SHIFT					0
4398c2ecf20Sopenharmony_ci#define CNTR1_CFG_MASK					(0xf << 0)
4408c2ecf20Sopenharmony_ci
4418c2ecf20Sopenharmony_ci/* PERFORMANCE_COUNTER_MASTER_REGION_SELECT */
4428c2ecf20Sopenharmony_ci#define MCONNID2_SHIFT					24
4438c2ecf20Sopenharmony_ci#define MCONNID2_MASK					(0xff << 24)
4448c2ecf20Sopenharmony_ci#define REGION_SEL2_SHIFT				16
4458c2ecf20Sopenharmony_ci#define REGION_SEL2_MASK				(0x3 << 16)
4468c2ecf20Sopenharmony_ci#define MCONNID1_SHIFT					8
4478c2ecf20Sopenharmony_ci#define MCONNID1_MASK					(0xff << 8)
4488c2ecf20Sopenharmony_ci#define REGION_SEL1_SHIFT				0
4498c2ecf20Sopenharmony_ci#define REGION_SEL1_MASK				(0x3 << 0)
4508c2ecf20Sopenharmony_ci
4518c2ecf20Sopenharmony_ci/* PERFORMANCE_COUNTER_TIME */
4528c2ecf20Sopenharmony_ci#define TOTAL_TIME_SHIFT				0
4538c2ecf20Sopenharmony_ci#define TOTAL_TIME_MASK					(0xffffffff << 0)
4548c2ecf20Sopenharmony_ci
4558c2ecf20Sopenharmony_ci/* DLL_CALIB_CTRL */
4568c2ecf20Sopenharmony_ci#define ACK_WAIT_SHIFT					16
4578c2ecf20Sopenharmony_ci#define ACK_WAIT_MASK					(0xf << 16)
4588c2ecf20Sopenharmony_ci#define DLL_CALIB_INTERVAL_SHIFT			0
4598c2ecf20Sopenharmony_ci#define DLL_CALIB_INTERVAL_MASK				(0x1ff << 0)
4608c2ecf20Sopenharmony_ci
4618c2ecf20Sopenharmony_ci/* END_OF_INTERRUPT */
4628c2ecf20Sopenharmony_ci#define EOI_SHIFT					0
4638c2ecf20Sopenharmony_ci#define EOI_MASK					(1 << 0)
4648c2ecf20Sopenharmony_ci
4658c2ecf20Sopenharmony_ci/* SYSTEM_OCP_INTERRUPT_RAW_STATUS */
4668c2ecf20Sopenharmony_ci#define DNV_SYS_SHIFT					2
4678c2ecf20Sopenharmony_ci#define DNV_SYS_MASK					(1 << 2)
4688c2ecf20Sopenharmony_ci#define TA_SYS_SHIFT					1
4698c2ecf20Sopenharmony_ci#define TA_SYS_MASK					(1 << 1)
4708c2ecf20Sopenharmony_ci#define ERR_SYS_SHIFT					0
4718c2ecf20Sopenharmony_ci#define ERR_SYS_MASK					(1 << 0)
4728c2ecf20Sopenharmony_ci
4738c2ecf20Sopenharmony_ci/* LOW_LATENCY_OCP_INTERRUPT_RAW_STATUS */
4748c2ecf20Sopenharmony_ci#define DNV_LL_SHIFT					2
4758c2ecf20Sopenharmony_ci#define DNV_LL_MASK					(1 << 2)
4768c2ecf20Sopenharmony_ci#define TA_LL_SHIFT					1
4778c2ecf20Sopenharmony_ci#define TA_LL_MASK					(1 << 1)
4788c2ecf20Sopenharmony_ci#define ERR_LL_SHIFT					0
4798c2ecf20Sopenharmony_ci#define ERR_LL_MASK					(1 << 0)
4808c2ecf20Sopenharmony_ci
4818c2ecf20Sopenharmony_ci/* SYSTEM_OCP_INTERRUPT_ENABLE_SET */
4828c2ecf20Sopenharmony_ci#define EN_DNV_SYS_SHIFT				2
4838c2ecf20Sopenharmony_ci#define EN_DNV_SYS_MASK					(1 << 2)
4848c2ecf20Sopenharmony_ci#define EN_TA_SYS_SHIFT					1
4858c2ecf20Sopenharmony_ci#define EN_TA_SYS_MASK					(1 << 1)
4868c2ecf20Sopenharmony_ci#define EN_ERR_SYS_SHIFT					0
4878c2ecf20Sopenharmony_ci#define EN_ERR_SYS_MASK					(1 << 0)
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ci/* LOW_LATENCY_OCP_INTERRUPT_ENABLE_SET */
4908c2ecf20Sopenharmony_ci#define EN_DNV_LL_SHIFT					2
4918c2ecf20Sopenharmony_ci#define EN_DNV_LL_MASK					(1 << 2)
4928c2ecf20Sopenharmony_ci#define EN_TA_LL_SHIFT					1
4938c2ecf20Sopenharmony_ci#define EN_TA_LL_MASK					(1 << 1)
4948c2ecf20Sopenharmony_ci#define EN_ERR_LL_SHIFT					0
4958c2ecf20Sopenharmony_ci#define EN_ERR_LL_MASK					(1 << 0)
4968c2ecf20Sopenharmony_ci
4978c2ecf20Sopenharmony_ci/* SDRAM_OUTPUT_IMPEDANCE_CALIBRATION_CONFIG */
4988c2ecf20Sopenharmony_ci#define ZQ_CS1EN_SHIFT					31
4998c2ecf20Sopenharmony_ci#define ZQ_CS1EN_MASK					(1 << 31)
5008c2ecf20Sopenharmony_ci#define ZQ_CS0EN_SHIFT					30
5018c2ecf20Sopenharmony_ci#define ZQ_CS0EN_MASK					(1 << 30)
5028c2ecf20Sopenharmony_ci#define ZQ_DUALCALEN_SHIFT				29
5038c2ecf20Sopenharmony_ci#define ZQ_DUALCALEN_MASK				(1 << 29)
5048c2ecf20Sopenharmony_ci#define ZQ_SFEXITEN_SHIFT				28
5058c2ecf20Sopenharmony_ci#define ZQ_SFEXITEN_MASK				(1 << 28)
5068c2ecf20Sopenharmony_ci#define ZQ_ZQINIT_MULT_SHIFT				18
5078c2ecf20Sopenharmony_ci#define ZQ_ZQINIT_MULT_MASK				(0x3 << 18)
5088c2ecf20Sopenharmony_ci#define ZQ_ZQCL_MULT_SHIFT				16
5098c2ecf20Sopenharmony_ci#define ZQ_ZQCL_MULT_MASK				(0x3 << 16)
5108c2ecf20Sopenharmony_ci#define ZQ_REFINTERVAL_SHIFT				0
5118c2ecf20Sopenharmony_ci#define ZQ_REFINTERVAL_MASK				(0xffff << 0)
5128c2ecf20Sopenharmony_ci
5138c2ecf20Sopenharmony_ci/* TEMPERATURE_ALERT_CONFIG */
5148c2ecf20Sopenharmony_ci#define TA_CS1EN_SHIFT					31
5158c2ecf20Sopenharmony_ci#define TA_CS1EN_MASK					(1 << 31)
5168c2ecf20Sopenharmony_ci#define TA_CS0EN_SHIFT					30
5178c2ecf20Sopenharmony_ci#define TA_CS0EN_MASK					(1 << 30)
5188c2ecf20Sopenharmony_ci#define TA_SFEXITEN_SHIFT				28
5198c2ecf20Sopenharmony_ci#define TA_SFEXITEN_MASK				(1 << 28)
5208c2ecf20Sopenharmony_ci#define TA_DEVWDT_SHIFT					26
5218c2ecf20Sopenharmony_ci#define TA_DEVWDT_MASK					(0x3 << 26)
5228c2ecf20Sopenharmony_ci#define TA_DEVCNT_SHIFT					24
5238c2ecf20Sopenharmony_ci#define TA_DEVCNT_MASK					(0x3 << 24)
5248c2ecf20Sopenharmony_ci#define TA_REFINTERVAL_SHIFT				0
5258c2ecf20Sopenharmony_ci#define TA_REFINTERVAL_MASK				(0x3fffff << 0)
5268c2ecf20Sopenharmony_ci
5278c2ecf20Sopenharmony_ci/* OCP_ERROR_LOG */
5288c2ecf20Sopenharmony_ci#define MADDRSPACE_SHIFT				14
5298c2ecf20Sopenharmony_ci#define MADDRSPACE_MASK					(0x3 << 14)
5308c2ecf20Sopenharmony_ci#define MBURSTSEQ_SHIFT					11
5318c2ecf20Sopenharmony_ci#define MBURSTSEQ_MASK					(0x7 << 11)
5328c2ecf20Sopenharmony_ci#define MCMD_SHIFT					8
5338c2ecf20Sopenharmony_ci#define MCMD_MASK					(0x7 << 8)
5348c2ecf20Sopenharmony_ci#define MCONNID_SHIFT					0
5358c2ecf20Sopenharmony_ci#define MCONNID_MASK					(0xff << 0)
5368c2ecf20Sopenharmony_ci
5378c2ecf20Sopenharmony_ci/* READ_WRITE_LEVELING_CONTROL */
5388c2ecf20Sopenharmony_ci#define RDWRLVLFULL_START				0x80000000
5398c2ecf20Sopenharmony_ci
5408c2ecf20Sopenharmony_ci/* DDR_PHY_CTRL_1 - EMIF4D */
5418c2ecf20Sopenharmony_ci#define DLL_SLAVE_DLY_CTRL_SHIFT_4D			4
5428c2ecf20Sopenharmony_ci#define DLL_SLAVE_DLY_CTRL_MASK_4D			(0xFF << 4)
5438c2ecf20Sopenharmony_ci#define READ_LATENCY_SHIFT_4D				0
5448c2ecf20Sopenharmony_ci#define READ_LATENCY_MASK_4D				(0xf << 0)
5458c2ecf20Sopenharmony_ci
5468c2ecf20Sopenharmony_ci/* DDR_PHY_CTRL_1 - EMIF4D5 */
5478c2ecf20Sopenharmony_ci#define DLL_HALF_DELAY_SHIFT_4D5			21
5488c2ecf20Sopenharmony_ci#define DLL_HALF_DELAY_MASK_4D5				(1 << 21)
5498c2ecf20Sopenharmony_ci#define READ_LATENCY_SHIFT_4D5				0
5508c2ecf20Sopenharmony_ci#define READ_LATENCY_MASK_4D5				(0x1f << 0)
5518c2ecf20Sopenharmony_ci
5528c2ecf20Sopenharmony_ci/* DDR_PHY_CTRL_1_SHDW */
5538c2ecf20Sopenharmony_ci#define DDR_PHY_CTRL_1_SHDW_SHIFT			5
5548c2ecf20Sopenharmony_ci#define DDR_PHY_CTRL_1_SHDW_MASK			(0x7ffffff << 5)
5558c2ecf20Sopenharmony_ci#define READ_LATENCY_SHDW_SHIFT				0
5568c2ecf20Sopenharmony_ci#define READ_LATENCY_SHDW_MASK				(0x1f << 0)
5578c2ecf20Sopenharmony_ci
5588c2ecf20Sopenharmony_ci#define EMIF_SRAM_AM33_REG_LAYOUT			0x00000000
5598c2ecf20Sopenharmony_ci#define EMIF_SRAM_AM43_REG_LAYOUT			0x00000001
5608c2ecf20Sopenharmony_ci
5618c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
5628c2ecf20Sopenharmony_ci/*
5638c2ecf20Sopenharmony_ci * Structure containing shadow of important registers in EMIF
5648c2ecf20Sopenharmony_ci * The calculation function fills in this structure to be later used for
5658c2ecf20Sopenharmony_ci * initialisation and DVFS
5668c2ecf20Sopenharmony_ci */
5678c2ecf20Sopenharmony_cistruct emif_regs {
5688c2ecf20Sopenharmony_ci	u32 freq;
5698c2ecf20Sopenharmony_ci	u32 ref_ctrl_shdw;
5708c2ecf20Sopenharmony_ci	u32 ref_ctrl_shdw_derated;
5718c2ecf20Sopenharmony_ci	u32 sdram_tim1_shdw;
5728c2ecf20Sopenharmony_ci	u32 sdram_tim1_shdw_derated;
5738c2ecf20Sopenharmony_ci	u32 sdram_tim2_shdw;
5748c2ecf20Sopenharmony_ci	u32 sdram_tim3_shdw;
5758c2ecf20Sopenharmony_ci	u32 sdram_tim3_shdw_derated;
5768c2ecf20Sopenharmony_ci	u32 pwr_mgmt_ctrl_shdw;
5778c2ecf20Sopenharmony_ci	union {
5788c2ecf20Sopenharmony_ci		u32 read_idle_ctrl_shdw_normal;
5798c2ecf20Sopenharmony_ci		u32 dll_calib_ctrl_shdw_normal;
5808c2ecf20Sopenharmony_ci	};
5818c2ecf20Sopenharmony_ci	union {
5828c2ecf20Sopenharmony_ci		u32 read_idle_ctrl_shdw_volt_ramp;
5838c2ecf20Sopenharmony_ci		u32 dll_calib_ctrl_shdw_volt_ramp;
5848c2ecf20Sopenharmony_ci	};
5858c2ecf20Sopenharmony_ci
5868c2ecf20Sopenharmony_ci	u32 phy_ctrl_1_shdw;
5878c2ecf20Sopenharmony_ci	u32 ext_phy_ctrl_2_shdw;
5888c2ecf20Sopenharmony_ci	u32 ext_phy_ctrl_3_shdw;
5898c2ecf20Sopenharmony_ci	u32 ext_phy_ctrl_4_shdw;
5908c2ecf20Sopenharmony_ci};
5918c2ecf20Sopenharmony_ci
5928c2ecf20Sopenharmony_cistruct ti_emif_pm_functions;
5938c2ecf20Sopenharmony_ci
5948c2ecf20Sopenharmony_ciextern unsigned int ti_emif_sram;
5958c2ecf20Sopenharmony_ciextern unsigned int ti_emif_sram_sz;
5968c2ecf20Sopenharmony_ciextern struct ti_emif_pm_data ti_emif_pm_sram_data;
5978c2ecf20Sopenharmony_ciextern struct emif_regs_amx3 ti_emif_regs_amx3;
5988c2ecf20Sopenharmony_ci
5998c2ecf20Sopenharmony_civoid ti_emif_save_context(void);
6008c2ecf20Sopenharmony_civoid ti_emif_restore_context(void);
6018c2ecf20Sopenharmony_civoid ti_emif_run_hw_leveling(void);
6028c2ecf20Sopenharmony_civoid ti_emif_enter_sr(void);
6038c2ecf20Sopenharmony_civoid ti_emif_exit_sr(void);
6048c2ecf20Sopenharmony_civoid ti_emif_abort_sr(void);
6058c2ecf20Sopenharmony_ci
6068c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */
6078c2ecf20Sopenharmony_ci#endif /* __EMIF_H */
608