162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Defines for the EMIF driver
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2012 Texas Instruments, Inc.
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Benoit Cousson (b-cousson@ti.com)
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci#ifndef __EMIF_H
1062306a36Sopenharmony_ci#define __EMIF_H
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci/*
1362306a36Sopenharmony_ci * Maximum number of different frequencies supported by EMIF driver
1462306a36Sopenharmony_ci * Determines the number of entries in the pointer array for register
1562306a36Sopenharmony_ci * cache
1662306a36Sopenharmony_ci */
1762306a36Sopenharmony_ci#define EMIF_MAX_NUM_FREQUENCIES			6
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci/* State of the core voltage */
2062306a36Sopenharmony_ci#define DDR_VOLTAGE_STABLE				0
2162306a36Sopenharmony_ci#define DDR_VOLTAGE_RAMPING				1
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci/* Defines for timing De-rating */
2462306a36Sopenharmony_ci#define EMIF_NORMAL_TIMINGS				0
2562306a36Sopenharmony_ci#define EMIF_DERATED_TIMINGS				1
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci/* Length of the forced read idle period in terms of cycles */
2862306a36Sopenharmony_ci#define EMIF_READ_IDLE_LEN_VAL				5
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci/*
3162306a36Sopenharmony_ci * forced read idle interval to be used when voltage
3262306a36Sopenharmony_ci * is changed as part of DVFS/DPS - 1ms
3362306a36Sopenharmony_ci */
3462306a36Sopenharmony_ci#define READ_IDLE_INTERVAL_DVFS				(1*1000000)
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci/*
3762306a36Sopenharmony_ci * Forced read idle interval to be used when voltage is stable
3862306a36Sopenharmony_ci * 50us - or maximum value will do
3962306a36Sopenharmony_ci */
4062306a36Sopenharmony_ci#define READ_IDLE_INTERVAL_NORMAL			(50*1000000)
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci/* DLL calibration interval when voltage is NOT stable - 1us */
4362306a36Sopenharmony_ci#define DLL_CALIB_INTERVAL_DVFS				(1*1000000)
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci#define DLL_CALIB_ACK_WAIT_VAL				5
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci/* Interval between ZQCS commands - hw team recommended value */
4862306a36Sopenharmony_ci#define EMIF_ZQCS_INTERVAL_US				(50*1000)
4962306a36Sopenharmony_ci/* Enable ZQ Calibration on exiting Self-refresh */
5062306a36Sopenharmony_ci#define ZQ_SFEXITEN_ENABLE				1
5162306a36Sopenharmony_ci/*
5262306a36Sopenharmony_ci * ZQ Calibration simultaneously on both chip-selects:
5362306a36Sopenharmony_ci * Needs one calibration resistor per CS
5462306a36Sopenharmony_ci */
5562306a36Sopenharmony_ci#define	ZQ_DUALCALEN_DISABLE				0
5662306a36Sopenharmony_ci#define	ZQ_DUALCALEN_ENABLE				1
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci#define T_ZQCS_DEFAULT_NS				90
5962306a36Sopenharmony_ci#define T_ZQCL_DEFAULT_NS				360
6062306a36Sopenharmony_ci#define T_ZQINIT_DEFAULT_NS				1000
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci/* DPD_EN */
6362306a36Sopenharmony_ci#define DPD_DISABLE					0
6462306a36Sopenharmony_ci#define DPD_ENABLE					1
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci/*
6762306a36Sopenharmony_ci * Default values for the low-power entry to be used if not provided by user.
6862306a36Sopenharmony_ci * OMAP4/5 has a hw bug(i735) due to which this value can not be less than 512
6962306a36Sopenharmony_ci * Timeout values are in DDR clock 'cycles' and frequency threshold in Hz
7062306a36Sopenharmony_ci */
7162306a36Sopenharmony_ci#define EMIF_LP_MODE_TIMEOUT_PERFORMANCE		2048
7262306a36Sopenharmony_ci#define EMIF_LP_MODE_TIMEOUT_POWER			512
7362306a36Sopenharmony_ci#define EMIF_LP_MODE_FREQ_THRESHOLD			400000000
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci/* DDR_PHY_CTRL_1 values for EMIF4D - ATTILA PHY combination */
7662306a36Sopenharmony_ci#define EMIF_DDR_PHY_CTRL_1_BASE_VAL_ATTILAPHY		0x049FF000
7762306a36Sopenharmony_ci#define EMIF_DLL_SLAVE_DLY_CTRL_400_MHZ_ATTILAPHY	0x41
7862306a36Sopenharmony_ci#define EMIF_DLL_SLAVE_DLY_CTRL_200_MHZ_ATTILAPHY	0x80
7962306a36Sopenharmony_ci#define EMIF_DLL_SLAVE_DLY_CTRL_100_MHZ_AND_LESS_ATTILAPHY 0xFF
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci/* DDR_PHY_CTRL_1 values for EMIF4D5 INTELLIPHY combination */
8262306a36Sopenharmony_ci#define EMIF_DDR_PHY_CTRL_1_BASE_VAL_INTELLIPHY		0x0E084200
8362306a36Sopenharmony_ci#define EMIF_PHY_TOTAL_READ_LATENCY_INTELLIPHY_PS	10000
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci/* TEMP_ALERT_CONFIG - corresponding to temp gradient 5 C/s */
8662306a36Sopenharmony_ci#define TEMP_ALERT_POLL_INTERVAL_DEFAULT_MS		360
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ci#define EMIF_T_CSTA					3
8962306a36Sopenharmony_ci#define EMIF_T_PDLL_UL					128
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci/* External PHY control registers magic values */
9262306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_1_VAL				0x04020080
9362306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_5_VAL				0x04010040
9462306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_6_VAL				0x01004010
9562306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_7_VAL				0x00001004
9662306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_8_VAL				0x04010040
9762306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_9_VAL				0x01004010
9862306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_10_VAL			0x00001004
9962306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_11_VAL			0x00000000
10062306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_12_VAL			0x00000000
10162306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_13_VAL			0x00000000
10262306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_14_VAL			0x80080080
10362306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_15_VAL			0x00800800
10462306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_16_VAL			0x08102040
10562306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_17_VAL			0x00000001
10662306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_18_VAL			0x540A8150
10762306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_19_VAL			0xA81502A0
10862306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_20_VAL			0x002A0540
10962306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_21_VAL			0x00000000
11062306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_22_VAL			0x00000000
11162306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_23_VAL			0x00000000
11262306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_24_VAL			0x00000077
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci#define EMIF_INTELLI_PHY_DQS_GATE_OPENING_DELAY_PS	1200
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci/* Registers offset */
11762306a36Sopenharmony_ci#define EMIF_MODULE_ID_AND_REVISION			0x0000
11862306a36Sopenharmony_ci#define EMIF_STATUS					0x0004
11962306a36Sopenharmony_ci#define EMIF_SDRAM_CONFIG				0x0008
12062306a36Sopenharmony_ci#define EMIF_SDRAM_CONFIG_2				0x000c
12162306a36Sopenharmony_ci#define EMIF_SDRAM_REFRESH_CONTROL			0x0010
12262306a36Sopenharmony_ci#define EMIF_SDRAM_REFRESH_CTRL_SHDW			0x0014
12362306a36Sopenharmony_ci#define EMIF_SDRAM_TIMING_1				0x0018
12462306a36Sopenharmony_ci#define EMIF_SDRAM_TIMING_1_SHDW			0x001c
12562306a36Sopenharmony_ci#define EMIF_SDRAM_TIMING_2				0x0020
12662306a36Sopenharmony_ci#define EMIF_SDRAM_TIMING_2_SHDW			0x0024
12762306a36Sopenharmony_ci#define EMIF_SDRAM_TIMING_3				0x0028
12862306a36Sopenharmony_ci#define EMIF_SDRAM_TIMING_3_SHDW			0x002c
12962306a36Sopenharmony_ci#define EMIF_LPDDR2_NVM_TIMING				0x0030
13062306a36Sopenharmony_ci#define EMIF_LPDDR2_NVM_TIMING_SHDW			0x0034
13162306a36Sopenharmony_ci#define EMIF_POWER_MANAGEMENT_CONTROL			0x0038
13262306a36Sopenharmony_ci#define EMIF_POWER_MANAGEMENT_CTRL_SHDW			0x003c
13362306a36Sopenharmony_ci#define EMIF_LPDDR2_MODE_REG_DATA			0x0040
13462306a36Sopenharmony_ci#define EMIF_LPDDR2_MODE_REG_CONFIG			0x0050
13562306a36Sopenharmony_ci#define EMIF_OCP_CONFIG					0x0054
13662306a36Sopenharmony_ci#define EMIF_OCP_CONFIG_VALUE_1				0x0058
13762306a36Sopenharmony_ci#define EMIF_OCP_CONFIG_VALUE_2				0x005c
13862306a36Sopenharmony_ci#define EMIF_IODFT_TEST_LOGIC_GLOBAL_CONTROL		0x0060
13962306a36Sopenharmony_ci#define EMIF_IODFT_TEST_LOGIC_CTRL_MISR_RESULT		0x0064
14062306a36Sopenharmony_ci#define EMIF_IODFT_TEST_LOGIC_ADDRESS_MISR_RESULT	0x0068
14162306a36Sopenharmony_ci#define EMIF_IODFT_TEST_LOGIC_DATA_MISR_RESULT_1	0x006c
14262306a36Sopenharmony_ci#define EMIF_IODFT_TEST_LOGIC_DATA_MISR_RESULT_2	0x0070
14362306a36Sopenharmony_ci#define EMIF_IODFT_TEST_LOGIC_DATA_MISR_RESULT_3	0x0074
14462306a36Sopenharmony_ci#define EMIF_PERFORMANCE_COUNTER_1			0x0080
14562306a36Sopenharmony_ci#define EMIF_PERFORMANCE_COUNTER_2			0x0084
14662306a36Sopenharmony_ci#define EMIF_PERFORMANCE_COUNTER_CONFIG			0x0088
14762306a36Sopenharmony_ci#define EMIF_PERFORMANCE_COUNTER_MASTER_REGION_SELECT	0x008c
14862306a36Sopenharmony_ci#define EMIF_PERFORMANCE_COUNTER_TIME			0x0090
14962306a36Sopenharmony_ci#define EMIF_MISC_REG					0x0094
15062306a36Sopenharmony_ci#define EMIF_DLL_CALIB_CTRL				0x0098
15162306a36Sopenharmony_ci#define EMIF_DLL_CALIB_CTRL_SHDW			0x009c
15262306a36Sopenharmony_ci#define EMIF_END_OF_INTERRUPT				0x00a0
15362306a36Sopenharmony_ci#define EMIF_SYSTEM_OCP_INTERRUPT_RAW_STATUS		0x00a4
15462306a36Sopenharmony_ci#define EMIF_LL_OCP_INTERRUPT_RAW_STATUS		0x00a8
15562306a36Sopenharmony_ci#define EMIF_SYSTEM_OCP_INTERRUPT_STATUS		0x00ac
15662306a36Sopenharmony_ci#define EMIF_LL_OCP_INTERRUPT_STATUS			0x00b0
15762306a36Sopenharmony_ci#define EMIF_SYSTEM_OCP_INTERRUPT_ENABLE_SET		0x00b4
15862306a36Sopenharmony_ci#define EMIF_LL_OCP_INTERRUPT_ENABLE_SET		0x00b8
15962306a36Sopenharmony_ci#define EMIF_SYSTEM_OCP_INTERRUPT_ENABLE_CLEAR		0x00bc
16062306a36Sopenharmony_ci#define EMIF_LL_OCP_INTERRUPT_ENABLE_CLEAR		0x00c0
16162306a36Sopenharmony_ci#define EMIF_SDRAM_OUTPUT_IMPEDANCE_CALIBRATION_CONFIG	0x00c8
16262306a36Sopenharmony_ci#define EMIF_TEMPERATURE_ALERT_CONFIG			0x00cc
16362306a36Sopenharmony_ci#define EMIF_OCP_ERROR_LOG				0x00d0
16462306a36Sopenharmony_ci#define EMIF_READ_WRITE_LEVELING_RAMP_WINDOW		0x00d4
16562306a36Sopenharmony_ci#define EMIF_READ_WRITE_LEVELING_RAMP_CONTROL		0x00d8
16662306a36Sopenharmony_ci#define EMIF_READ_WRITE_LEVELING_CONTROL		0x00dc
16762306a36Sopenharmony_ci#define EMIF_DDR_PHY_CTRL_1				0x00e4
16862306a36Sopenharmony_ci#define EMIF_DDR_PHY_CTRL_1_SHDW			0x00e8
16962306a36Sopenharmony_ci#define EMIF_DDR_PHY_CTRL_2				0x00ec
17062306a36Sopenharmony_ci#define EMIF_PRIORITY_TO_CLASS_OF_SERVICE_MAPPING	0x0100
17162306a36Sopenharmony_ci#define EMIF_CONNECTION_ID_TO_CLASS_OF_SERVICE_1_MAPPING 0x0104
17262306a36Sopenharmony_ci#define EMIF_CONNECTION_ID_TO_CLASS_OF_SERVICE_2_MAPPING 0x0108
17362306a36Sopenharmony_ci#define EMIF_READ_WRITE_EXECUTION_THRESHOLD		0x0120
17462306a36Sopenharmony_ci#define EMIF_COS_CONFIG					0x0124
17562306a36Sopenharmony_ci#define EMIF_PHY_STATUS_1				0x0140
17662306a36Sopenharmony_ci#define EMIF_PHY_STATUS_2				0x0144
17762306a36Sopenharmony_ci#define EMIF_PHY_STATUS_3				0x0148
17862306a36Sopenharmony_ci#define EMIF_PHY_STATUS_4				0x014c
17962306a36Sopenharmony_ci#define EMIF_PHY_STATUS_5				0x0150
18062306a36Sopenharmony_ci#define EMIF_PHY_STATUS_6				0x0154
18162306a36Sopenharmony_ci#define EMIF_PHY_STATUS_7				0x0158
18262306a36Sopenharmony_ci#define EMIF_PHY_STATUS_8				0x015c
18362306a36Sopenharmony_ci#define EMIF_PHY_STATUS_9				0x0160
18462306a36Sopenharmony_ci#define EMIF_PHY_STATUS_10				0x0164
18562306a36Sopenharmony_ci#define EMIF_PHY_STATUS_11				0x0168
18662306a36Sopenharmony_ci#define EMIF_PHY_STATUS_12				0x016c
18762306a36Sopenharmony_ci#define EMIF_PHY_STATUS_13				0x0170
18862306a36Sopenharmony_ci#define EMIF_PHY_STATUS_14				0x0174
18962306a36Sopenharmony_ci#define EMIF_PHY_STATUS_15				0x0178
19062306a36Sopenharmony_ci#define EMIF_PHY_STATUS_16				0x017c
19162306a36Sopenharmony_ci#define EMIF_PHY_STATUS_17				0x0180
19262306a36Sopenharmony_ci#define EMIF_PHY_STATUS_18				0x0184
19362306a36Sopenharmony_ci#define EMIF_PHY_STATUS_19				0x0188
19462306a36Sopenharmony_ci#define EMIF_PHY_STATUS_20				0x018c
19562306a36Sopenharmony_ci#define EMIF_PHY_STATUS_21				0x0190
19662306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_1				0x0200
19762306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_1_SHDW			0x0204
19862306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_2				0x0208
19962306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_2_SHDW			0x020c
20062306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_3				0x0210
20162306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_3_SHDW			0x0214
20262306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_4				0x0218
20362306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_4_SHDW			0x021c
20462306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_5				0x0220
20562306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_5_SHDW			0x0224
20662306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_6				0x0228
20762306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_6_SHDW			0x022c
20862306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_7				0x0230
20962306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_7_SHDW			0x0234
21062306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_8				0x0238
21162306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_8_SHDW			0x023c
21262306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_9				0x0240
21362306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_9_SHDW			0x0244
21462306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_10				0x0248
21562306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_10_SHDW			0x024c
21662306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_11				0x0250
21762306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_11_SHDW			0x0254
21862306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_12				0x0258
21962306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_12_SHDW			0x025c
22062306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_13				0x0260
22162306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_13_SHDW			0x0264
22262306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_14				0x0268
22362306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_14_SHDW			0x026c
22462306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_15				0x0270
22562306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_15_SHDW			0x0274
22662306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_16				0x0278
22762306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_16_SHDW			0x027c
22862306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_17				0x0280
22962306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_17_SHDW			0x0284
23062306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_18				0x0288
23162306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_18_SHDW			0x028c
23262306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_19				0x0290
23362306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_19_SHDW			0x0294
23462306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_20				0x0298
23562306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_20_SHDW			0x029c
23662306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_21				0x02a0
23762306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_21_SHDW			0x02a4
23862306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_22				0x02a8
23962306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_22_SHDW			0x02ac
24062306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_23				0x02b0
24162306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_23_SHDW			0x02b4
24262306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_24				0x02b8
24362306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_24_SHDW			0x02bc
24462306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_25				0x02c0
24562306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_25_SHDW			0x02c4
24662306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_26				0x02c8
24762306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_26_SHDW			0x02cc
24862306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_27				0x02d0
24962306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_27_SHDW			0x02d4
25062306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_28				0x02d8
25162306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_28_SHDW			0x02dc
25262306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_29				0x02e0
25362306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_29_SHDW			0x02e4
25462306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_30				0x02e8
25562306a36Sopenharmony_ci#define EMIF_EXT_PHY_CTRL_30_SHDW			0x02ec
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_ci/* Registers shifts and masks */
25862306a36Sopenharmony_ci
25962306a36Sopenharmony_ci/* EMIF_MODULE_ID_AND_REVISION */
26062306a36Sopenharmony_ci#define SCHEME_SHIFT					30
26162306a36Sopenharmony_ci#define SCHEME_MASK					(0x3 << 30)
26262306a36Sopenharmony_ci#define MODULE_ID_SHIFT					16
26362306a36Sopenharmony_ci#define MODULE_ID_MASK					(0xfff << 16)
26462306a36Sopenharmony_ci#define RTL_VERSION_SHIFT				11
26562306a36Sopenharmony_ci#define RTL_VERSION_MASK				(0x1f << 11)
26662306a36Sopenharmony_ci#define MAJOR_REVISION_SHIFT				8
26762306a36Sopenharmony_ci#define MAJOR_REVISION_MASK				(0x7 << 8)
26862306a36Sopenharmony_ci#define MINOR_REVISION_SHIFT				0
26962306a36Sopenharmony_ci#define MINOR_REVISION_MASK				(0x3f << 0)
27062306a36Sopenharmony_ci
27162306a36Sopenharmony_ci/* STATUS */
27262306a36Sopenharmony_ci#define BE_SHIFT					31
27362306a36Sopenharmony_ci#define BE_MASK						(1 << 31)
27462306a36Sopenharmony_ci#define DUAL_CLK_MODE_SHIFT				30
27562306a36Sopenharmony_ci#define DUAL_CLK_MODE_MASK				(1 << 30)
27662306a36Sopenharmony_ci#define FAST_INIT_SHIFT					29
27762306a36Sopenharmony_ci#define FAST_INIT_MASK					(1 << 29)
27862306a36Sopenharmony_ci#define RDLVLGATETO_SHIFT				6
27962306a36Sopenharmony_ci#define RDLVLGATETO_MASK				(1 << 6)
28062306a36Sopenharmony_ci#define RDLVLTO_SHIFT					5
28162306a36Sopenharmony_ci#define RDLVLTO_MASK					(1 << 5)
28262306a36Sopenharmony_ci#define WRLVLTO_SHIFT					4
28362306a36Sopenharmony_ci#define WRLVLTO_MASK					(1 << 4)
28462306a36Sopenharmony_ci#define PHY_DLL_READY_SHIFT				2
28562306a36Sopenharmony_ci#define PHY_DLL_READY_MASK				(1 << 2)
28662306a36Sopenharmony_ci
28762306a36Sopenharmony_ci/* SDRAM_CONFIG */
28862306a36Sopenharmony_ci#define SDRAM_TYPE_SHIFT				29
28962306a36Sopenharmony_ci#define SDRAM_TYPE_MASK					(0x7 << 29)
29062306a36Sopenharmony_ci#define IBANK_POS_SHIFT					27
29162306a36Sopenharmony_ci#define IBANK_POS_MASK					(0x3 << 27)
29262306a36Sopenharmony_ci#define DDR_TERM_SHIFT					24
29362306a36Sopenharmony_ci#define DDR_TERM_MASK					(0x7 << 24)
29462306a36Sopenharmony_ci#define DDR2_DDQS_SHIFT					23
29562306a36Sopenharmony_ci#define DDR2_DDQS_MASK					(1 << 23)
29662306a36Sopenharmony_ci#define DYN_ODT_SHIFT					21
29762306a36Sopenharmony_ci#define DYN_ODT_MASK					(0x3 << 21)
29862306a36Sopenharmony_ci#define DDR_DISABLE_DLL_SHIFT				20
29962306a36Sopenharmony_ci#define DDR_DISABLE_DLL_MASK				(1 << 20)
30062306a36Sopenharmony_ci#define SDRAM_DRIVE_SHIFT				18
30162306a36Sopenharmony_ci#define SDRAM_DRIVE_MASK				(0x3 << 18)
30262306a36Sopenharmony_ci#define CWL_SHIFT					16
30362306a36Sopenharmony_ci#define CWL_MASK					(0x3 << 16)
30462306a36Sopenharmony_ci#define NARROW_MODE_SHIFT				14
30562306a36Sopenharmony_ci#define NARROW_MODE_MASK				(0x3 << 14)
30662306a36Sopenharmony_ci#define CL_SHIFT					10
30762306a36Sopenharmony_ci#define CL_MASK						(0xf << 10)
30862306a36Sopenharmony_ci#define ROWSIZE_SHIFT					7
30962306a36Sopenharmony_ci#define ROWSIZE_MASK					(0x7 << 7)
31062306a36Sopenharmony_ci#define IBANK_SHIFT					4
31162306a36Sopenharmony_ci#define IBANK_MASK					(0x7 << 4)
31262306a36Sopenharmony_ci#define EBANK_SHIFT					3
31362306a36Sopenharmony_ci#define EBANK_MASK					(1 << 3)
31462306a36Sopenharmony_ci#define PAGESIZE_SHIFT					0
31562306a36Sopenharmony_ci#define PAGESIZE_MASK					(0x7 << 0)
31662306a36Sopenharmony_ci
31762306a36Sopenharmony_ci/* SDRAM_CONFIG_2 */
31862306a36Sopenharmony_ci#define CS1NVMEN_SHIFT					30
31962306a36Sopenharmony_ci#define CS1NVMEN_MASK					(1 << 30)
32062306a36Sopenharmony_ci#define EBANK_POS_SHIFT					27
32162306a36Sopenharmony_ci#define EBANK_POS_MASK					(1 << 27)
32262306a36Sopenharmony_ci#define RDBNUM_SHIFT					4
32362306a36Sopenharmony_ci#define RDBNUM_MASK					(0x3 << 4)
32462306a36Sopenharmony_ci#define RDBSIZE_SHIFT					0
32562306a36Sopenharmony_ci#define RDBSIZE_MASK					(0x7 << 0)
32662306a36Sopenharmony_ci
32762306a36Sopenharmony_ci/* SDRAM_REFRESH_CONTROL */
32862306a36Sopenharmony_ci#define INITREF_DIS_SHIFT				31
32962306a36Sopenharmony_ci#define INITREF_DIS_MASK				(1 << 31)
33062306a36Sopenharmony_ci#define SRT_SHIFT					29
33162306a36Sopenharmony_ci#define SRT_MASK					(1 << 29)
33262306a36Sopenharmony_ci#define ASR_SHIFT					28
33362306a36Sopenharmony_ci#define ASR_MASK					(1 << 28)
33462306a36Sopenharmony_ci#define PASR_SHIFT					24
33562306a36Sopenharmony_ci#define PASR_MASK					(0x7 << 24)
33662306a36Sopenharmony_ci#define REFRESH_RATE_SHIFT				0
33762306a36Sopenharmony_ci#define REFRESH_RATE_MASK				(0xffff << 0)
33862306a36Sopenharmony_ci
33962306a36Sopenharmony_ci/* SDRAM_TIMING_1 */
34062306a36Sopenharmony_ci#define T_RTW_SHIFT					29
34162306a36Sopenharmony_ci#define T_RTW_MASK					(0x7 << 29)
34262306a36Sopenharmony_ci#define T_RP_SHIFT					25
34362306a36Sopenharmony_ci#define T_RP_MASK					(0xf << 25)
34462306a36Sopenharmony_ci#define T_RCD_SHIFT					21
34562306a36Sopenharmony_ci#define T_RCD_MASK					(0xf << 21)
34662306a36Sopenharmony_ci#define T_WR_SHIFT					17
34762306a36Sopenharmony_ci#define T_WR_MASK					(0xf << 17)
34862306a36Sopenharmony_ci#define T_RAS_SHIFT					12
34962306a36Sopenharmony_ci#define T_RAS_MASK					(0x1f << 12)
35062306a36Sopenharmony_ci#define T_RC_SHIFT					6
35162306a36Sopenharmony_ci#define T_RC_MASK					(0x3f << 6)
35262306a36Sopenharmony_ci#define T_RRD_SHIFT					3
35362306a36Sopenharmony_ci#define T_RRD_MASK					(0x7 << 3)
35462306a36Sopenharmony_ci#define T_WTR_SHIFT					0
35562306a36Sopenharmony_ci#define T_WTR_MASK					(0x7 << 0)
35662306a36Sopenharmony_ci
35762306a36Sopenharmony_ci/* SDRAM_TIMING_2 */
35862306a36Sopenharmony_ci#define T_XP_SHIFT					28
35962306a36Sopenharmony_ci#define T_XP_MASK					(0x7 << 28)
36062306a36Sopenharmony_ci#define T_ODT_SHIFT					25
36162306a36Sopenharmony_ci#define T_ODT_MASK					(0x7 << 25)
36262306a36Sopenharmony_ci#define T_XSNR_SHIFT					16
36362306a36Sopenharmony_ci#define T_XSNR_MASK					(0x1ff << 16)
36462306a36Sopenharmony_ci#define T_XSRD_SHIFT					6
36562306a36Sopenharmony_ci#define T_XSRD_MASK					(0x3ff << 6)
36662306a36Sopenharmony_ci#define T_RTP_SHIFT					3
36762306a36Sopenharmony_ci#define T_RTP_MASK					(0x7 << 3)
36862306a36Sopenharmony_ci#define T_CKE_SHIFT					0
36962306a36Sopenharmony_ci#define T_CKE_MASK					(0x7 << 0)
37062306a36Sopenharmony_ci
37162306a36Sopenharmony_ci/* SDRAM_TIMING_3 */
37262306a36Sopenharmony_ci#define T_PDLL_UL_SHIFT					28
37362306a36Sopenharmony_ci#define T_PDLL_UL_MASK					(0xf << 28)
37462306a36Sopenharmony_ci#define T_CSTA_SHIFT					24
37562306a36Sopenharmony_ci#define T_CSTA_MASK					(0xf << 24)
37662306a36Sopenharmony_ci#define T_CKESR_SHIFT					21
37762306a36Sopenharmony_ci#define T_CKESR_MASK					(0x7 << 21)
37862306a36Sopenharmony_ci#define ZQ_ZQCS_SHIFT					15
37962306a36Sopenharmony_ci#define ZQ_ZQCS_MASK					(0x3f << 15)
38062306a36Sopenharmony_ci#define T_TDQSCKMAX_SHIFT				13
38162306a36Sopenharmony_ci#define T_TDQSCKMAX_MASK				(0x3 << 13)
38262306a36Sopenharmony_ci#define T_RFC_SHIFT					4
38362306a36Sopenharmony_ci#define T_RFC_MASK					(0x1ff << 4)
38462306a36Sopenharmony_ci#define T_RAS_MAX_SHIFT					0
38562306a36Sopenharmony_ci#define T_RAS_MAX_MASK					(0xf << 0)
38662306a36Sopenharmony_ci
38762306a36Sopenharmony_ci/* POWER_MANAGEMENT_CONTROL */
38862306a36Sopenharmony_ci#define PD_TIM_SHIFT					12
38962306a36Sopenharmony_ci#define PD_TIM_MASK					(0xf << 12)
39062306a36Sopenharmony_ci#define DPD_EN_SHIFT					11
39162306a36Sopenharmony_ci#define DPD_EN_MASK					(1 << 11)
39262306a36Sopenharmony_ci#define LP_MODE_SHIFT					8
39362306a36Sopenharmony_ci#define LP_MODE_MASK					(0x7 << 8)
39462306a36Sopenharmony_ci#define SR_TIM_SHIFT					4
39562306a36Sopenharmony_ci#define SR_TIM_MASK					(0xf << 4)
39662306a36Sopenharmony_ci#define CS_TIM_SHIFT					0
39762306a36Sopenharmony_ci#define CS_TIM_MASK					(0xf << 0)
39862306a36Sopenharmony_ci
39962306a36Sopenharmony_ci/* LPDDR2_MODE_REG_DATA */
40062306a36Sopenharmony_ci#define VALUE_0_SHIFT					0
40162306a36Sopenharmony_ci#define VALUE_0_MASK					(0x7f << 0)
40262306a36Sopenharmony_ci
40362306a36Sopenharmony_ci/* LPDDR2_MODE_REG_CONFIG */
40462306a36Sopenharmony_ci#define CS_SHIFT					31
40562306a36Sopenharmony_ci#define CS_MASK						(1 << 31)
40662306a36Sopenharmony_ci#define REFRESH_EN_SHIFT				30
40762306a36Sopenharmony_ci#define REFRESH_EN_MASK					(1 << 30)
40862306a36Sopenharmony_ci#define ADDRESS_SHIFT					0
40962306a36Sopenharmony_ci#define ADDRESS_MASK					(0xff << 0)
41062306a36Sopenharmony_ci
41162306a36Sopenharmony_ci/* OCP_CONFIG */
41262306a36Sopenharmony_ci#define SYS_THRESH_MAX_SHIFT				24
41362306a36Sopenharmony_ci#define SYS_THRESH_MAX_MASK				(0xf << 24)
41462306a36Sopenharmony_ci#define MPU_THRESH_MAX_SHIFT				20
41562306a36Sopenharmony_ci#define MPU_THRESH_MAX_MASK				(0xf << 20)
41662306a36Sopenharmony_ci#define LL_THRESH_MAX_SHIFT				16
41762306a36Sopenharmony_ci#define LL_THRESH_MAX_MASK				(0xf << 16)
41862306a36Sopenharmony_ci
41962306a36Sopenharmony_ci/* PERFORMANCE_COUNTER_1 */
42062306a36Sopenharmony_ci#define COUNTER1_SHIFT					0
42162306a36Sopenharmony_ci#define COUNTER1_MASK					(0xffffffff << 0)
42262306a36Sopenharmony_ci
42362306a36Sopenharmony_ci/* PERFORMANCE_COUNTER_2 */
42462306a36Sopenharmony_ci#define COUNTER2_SHIFT					0
42562306a36Sopenharmony_ci#define COUNTER2_MASK					(0xffffffff << 0)
42662306a36Sopenharmony_ci
42762306a36Sopenharmony_ci/* PERFORMANCE_COUNTER_CONFIG */
42862306a36Sopenharmony_ci#define CNTR2_MCONNID_EN_SHIFT				31
42962306a36Sopenharmony_ci#define CNTR2_MCONNID_EN_MASK				(1 << 31)
43062306a36Sopenharmony_ci#define CNTR2_REGION_EN_SHIFT				30
43162306a36Sopenharmony_ci#define CNTR2_REGION_EN_MASK				(1 << 30)
43262306a36Sopenharmony_ci#define CNTR2_CFG_SHIFT					16
43362306a36Sopenharmony_ci#define CNTR2_CFG_MASK					(0xf << 16)
43462306a36Sopenharmony_ci#define CNTR1_MCONNID_EN_SHIFT				15
43562306a36Sopenharmony_ci#define CNTR1_MCONNID_EN_MASK				(1 << 15)
43662306a36Sopenharmony_ci#define CNTR1_REGION_EN_SHIFT				14
43762306a36Sopenharmony_ci#define CNTR1_REGION_EN_MASK				(1 << 14)
43862306a36Sopenharmony_ci#define CNTR1_CFG_SHIFT					0
43962306a36Sopenharmony_ci#define CNTR1_CFG_MASK					(0xf << 0)
44062306a36Sopenharmony_ci
44162306a36Sopenharmony_ci/* PERFORMANCE_COUNTER_MASTER_REGION_SELECT */
44262306a36Sopenharmony_ci#define MCONNID2_SHIFT					24
44362306a36Sopenharmony_ci#define MCONNID2_MASK					(0xff << 24)
44462306a36Sopenharmony_ci#define REGION_SEL2_SHIFT				16
44562306a36Sopenharmony_ci#define REGION_SEL2_MASK				(0x3 << 16)
44662306a36Sopenharmony_ci#define MCONNID1_SHIFT					8
44762306a36Sopenharmony_ci#define MCONNID1_MASK					(0xff << 8)
44862306a36Sopenharmony_ci#define REGION_SEL1_SHIFT				0
44962306a36Sopenharmony_ci#define REGION_SEL1_MASK				(0x3 << 0)
45062306a36Sopenharmony_ci
45162306a36Sopenharmony_ci/* PERFORMANCE_COUNTER_TIME */
45262306a36Sopenharmony_ci#define TOTAL_TIME_SHIFT				0
45362306a36Sopenharmony_ci#define TOTAL_TIME_MASK					(0xffffffff << 0)
45462306a36Sopenharmony_ci
45562306a36Sopenharmony_ci/* DLL_CALIB_CTRL */
45662306a36Sopenharmony_ci#define ACK_WAIT_SHIFT					16
45762306a36Sopenharmony_ci#define ACK_WAIT_MASK					(0xf << 16)
45862306a36Sopenharmony_ci#define DLL_CALIB_INTERVAL_SHIFT			0
45962306a36Sopenharmony_ci#define DLL_CALIB_INTERVAL_MASK				(0x1ff << 0)
46062306a36Sopenharmony_ci
46162306a36Sopenharmony_ci/* END_OF_INTERRUPT */
46262306a36Sopenharmony_ci#define EOI_SHIFT					0
46362306a36Sopenharmony_ci#define EOI_MASK					(1 << 0)
46462306a36Sopenharmony_ci
46562306a36Sopenharmony_ci/* SYSTEM_OCP_INTERRUPT_RAW_STATUS */
46662306a36Sopenharmony_ci#define DNV_SYS_SHIFT					2
46762306a36Sopenharmony_ci#define DNV_SYS_MASK					(1 << 2)
46862306a36Sopenharmony_ci#define TA_SYS_SHIFT					1
46962306a36Sopenharmony_ci#define TA_SYS_MASK					(1 << 1)
47062306a36Sopenharmony_ci#define ERR_SYS_SHIFT					0
47162306a36Sopenharmony_ci#define ERR_SYS_MASK					(1 << 0)
47262306a36Sopenharmony_ci
47362306a36Sopenharmony_ci/* LOW_LATENCY_OCP_INTERRUPT_RAW_STATUS */
47462306a36Sopenharmony_ci#define DNV_LL_SHIFT					2
47562306a36Sopenharmony_ci#define DNV_LL_MASK					(1 << 2)
47662306a36Sopenharmony_ci#define TA_LL_SHIFT					1
47762306a36Sopenharmony_ci#define TA_LL_MASK					(1 << 1)
47862306a36Sopenharmony_ci#define ERR_LL_SHIFT					0
47962306a36Sopenharmony_ci#define ERR_LL_MASK					(1 << 0)
48062306a36Sopenharmony_ci
48162306a36Sopenharmony_ci/* SYSTEM_OCP_INTERRUPT_ENABLE_SET */
48262306a36Sopenharmony_ci#define EN_DNV_SYS_SHIFT				2
48362306a36Sopenharmony_ci#define EN_DNV_SYS_MASK					(1 << 2)
48462306a36Sopenharmony_ci#define EN_TA_SYS_SHIFT					1
48562306a36Sopenharmony_ci#define EN_TA_SYS_MASK					(1 << 1)
48662306a36Sopenharmony_ci#define EN_ERR_SYS_SHIFT					0
48762306a36Sopenharmony_ci#define EN_ERR_SYS_MASK					(1 << 0)
48862306a36Sopenharmony_ci
48962306a36Sopenharmony_ci/* LOW_LATENCY_OCP_INTERRUPT_ENABLE_SET */
49062306a36Sopenharmony_ci#define EN_DNV_LL_SHIFT					2
49162306a36Sopenharmony_ci#define EN_DNV_LL_MASK					(1 << 2)
49262306a36Sopenharmony_ci#define EN_TA_LL_SHIFT					1
49362306a36Sopenharmony_ci#define EN_TA_LL_MASK					(1 << 1)
49462306a36Sopenharmony_ci#define EN_ERR_LL_SHIFT					0
49562306a36Sopenharmony_ci#define EN_ERR_LL_MASK					(1 << 0)
49662306a36Sopenharmony_ci
49762306a36Sopenharmony_ci/* SDRAM_OUTPUT_IMPEDANCE_CALIBRATION_CONFIG */
49862306a36Sopenharmony_ci#define ZQ_CS1EN_SHIFT					31
49962306a36Sopenharmony_ci#define ZQ_CS1EN_MASK					(1 << 31)
50062306a36Sopenharmony_ci#define ZQ_CS0EN_SHIFT					30
50162306a36Sopenharmony_ci#define ZQ_CS0EN_MASK					(1 << 30)
50262306a36Sopenharmony_ci#define ZQ_DUALCALEN_SHIFT				29
50362306a36Sopenharmony_ci#define ZQ_DUALCALEN_MASK				(1 << 29)
50462306a36Sopenharmony_ci#define ZQ_SFEXITEN_SHIFT				28
50562306a36Sopenharmony_ci#define ZQ_SFEXITEN_MASK				(1 << 28)
50662306a36Sopenharmony_ci#define ZQ_ZQINIT_MULT_SHIFT				18
50762306a36Sopenharmony_ci#define ZQ_ZQINIT_MULT_MASK				(0x3 << 18)
50862306a36Sopenharmony_ci#define ZQ_ZQCL_MULT_SHIFT				16
50962306a36Sopenharmony_ci#define ZQ_ZQCL_MULT_MASK				(0x3 << 16)
51062306a36Sopenharmony_ci#define ZQ_REFINTERVAL_SHIFT				0
51162306a36Sopenharmony_ci#define ZQ_REFINTERVAL_MASK				(0xffff << 0)
51262306a36Sopenharmony_ci
51362306a36Sopenharmony_ci/* TEMPERATURE_ALERT_CONFIG */
51462306a36Sopenharmony_ci#define TA_CS1EN_SHIFT					31
51562306a36Sopenharmony_ci#define TA_CS1EN_MASK					(1 << 31)
51662306a36Sopenharmony_ci#define TA_CS0EN_SHIFT					30
51762306a36Sopenharmony_ci#define TA_CS0EN_MASK					(1 << 30)
51862306a36Sopenharmony_ci#define TA_SFEXITEN_SHIFT				28
51962306a36Sopenharmony_ci#define TA_SFEXITEN_MASK				(1 << 28)
52062306a36Sopenharmony_ci#define TA_DEVWDT_SHIFT					26
52162306a36Sopenharmony_ci#define TA_DEVWDT_MASK					(0x3 << 26)
52262306a36Sopenharmony_ci#define TA_DEVCNT_SHIFT					24
52362306a36Sopenharmony_ci#define TA_DEVCNT_MASK					(0x3 << 24)
52462306a36Sopenharmony_ci#define TA_REFINTERVAL_SHIFT				0
52562306a36Sopenharmony_ci#define TA_REFINTERVAL_MASK				(0x3fffff << 0)
52662306a36Sopenharmony_ci
52762306a36Sopenharmony_ci/* OCP_ERROR_LOG */
52862306a36Sopenharmony_ci#define MADDRSPACE_SHIFT				14
52962306a36Sopenharmony_ci#define MADDRSPACE_MASK					(0x3 << 14)
53062306a36Sopenharmony_ci#define MBURSTSEQ_SHIFT					11
53162306a36Sopenharmony_ci#define MBURSTSEQ_MASK					(0x7 << 11)
53262306a36Sopenharmony_ci#define MCMD_SHIFT					8
53362306a36Sopenharmony_ci#define MCMD_MASK					(0x7 << 8)
53462306a36Sopenharmony_ci#define MCONNID_SHIFT					0
53562306a36Sopenharmony_ci#define MCONNID_MASK					(0xff << 0)
53662306a36Sopenharmony_ci
53762306a36Sopenharmony_ci/* READ_WRITE_LEVELING_CONTROL */
53862306a36Sopenharmony_ci#define RDWRLVLFULL_START				0x80000000
53962306a36Sopenharmony_ci
54062306a36Sopenharmony_ci/* DDR_PHY_CTRL_1 - EMIF4D */
54162306a36Sopenharmony_ci#define DLL_SLAVE_DLY_CTRL_SHIFT_4D			4
54262306a36Sopenharmony_ci#define DLL_SLAVE_DLY_CTRL_MASK_4D			(0xFF << 4)
54362306a36Sopenharmony_ci#define READ_LATENCY_SHIFT_4D				0
54462306a36Sopenharmony_ci#define READ_LATENCY_MASK_4D				(0xf << 0)
54562306a36Sopenharmony_ci
54662306a36Sopenharmony_ci/* DDR_PHY_CTRL_1 - EMIF4D5 */
54762306a36Sopenharmony_ci#define DLL_HALF_DELAY_SHIFT_4D5			21
54862306a36Sopenharmony_ci#define DLL_HALF_DELAY_MASK_4D5				(1 << 21)
54962306a36Sopenharmony_ci#define READ_LATENCY_SHIFT_4D5				0
55062306a36Sopenharmony_ci#define READ_LATENCY_MASK_4D5				(0x1f << 0)
55162306a36Sopenharmony_ci
55262306a36Sopenharmony_ci/* DDR_PHY_CTRL_1_SHDW */
55362306a36Sopenharmony_ci#define DDR_PHY_CTRL_1_SHDW_SHIFT			5
55462306a36Sopenharmony_ci#define DDR_PHY_CTRL_1_SHDW_MASK			(0x7ffffff << 5)
55562306a36Sopenharmony_ci#define READ_LATENCY_SHDW_SHIFT				0
55662306a36Sopenharmony_ci#define READ_LATENCY_SHDW_MASK				(0x1f << 0)
55762306a36Sopenharmony_ci
55862306a36Sopenharmony_ci#define EMIF_SRAM_AM33_REG_LAYOUT			0x00000000
55962306a36Sopenharmony_ci#define EMIF_SRAM_AM43_REG_LAYOUT			0x00000001
56062306a36Sopenharmony_ci
56162306a36Sopenharmony_ci#ifndef __ASSEMBLY__
56262306a36Sopenharmony_ci/*
56362306a36Sopenharmony_ci * Structure containing shadow of important registers in EMIF
56462306a36Sopenharmony_ci * The calculation function fills in this structure to be later used for
56562306a36Sopenharmony_ci * initialisation and DVFS
56662306a36Sopenharmony_ci */
56762306a36Sopenharmony_cistruct emif_regs {
56862306a36Sopenharmony_ci	u32 freq;
56962306a36Sopenharmony_ci	u32 ref_ctrl_shdw;
57062306a36Sopenharmony_ci	u32 ref_ctrl_shdw_derated;
57162306a36Sopenharmony_ci	u32 sdram_tim1_shdw;
57262306a36Sopenharmony_ci	u32 sdram_tim1_shdw_derated;
57362306a36Sopenharmony_ci	u32 sdram_tim2_shdw;
57462306a36Sopenharmony_ci	u32 sdram_tim3_shdw;
57562306a36Sopenharmony_ci	u32 sdram_tim3_shdw_derated;
57662306a36Sopenharmony_ci	u32 pwr_mgmt_ctrl_shdw;
57762306a36Sopenharmony_ci	union {
57862306a36Sopenharmony_ci		u32 read_idle_ctrl_shdw_normal;
57962306a36Sopenharmony_ci		u32 dll_calib_ctrl_shdw_normal;
58062306a36Sopenharmony_ci	};
58162306a36Sopenharmony_ci	union {
58262306a36Sopenharmony_ci		u32 read_idle_ctrl_shdw_volt_ramp;
58362306a36Sopenharmony_ci		u32 dll_calib_ctrl_shdw_volt_ramp;
58462306a36Sopenharmony_ci	};
58562306a36Sopenharmony_ci
58662306a36Sopenharmony_ci	u32 phy_ctrl_1_shdw;
58762306a36Sopenharmony_ci	u32 ext_phy_ctrl_2_shdw;
58862306a36Sopenharmony_ci	u32 ext_phy_ctrl_3_shdw;
58962306a36Sopenharmony_ci	u32 ext_phy_ctrl_4_shdw;
59062306a36Sopenharmony_ci};
59162306a36Sopenharmony_ci
59262306a36Sopenharmony_cistruct ti_emif_pm_functions;
59362306a36Sopenharmony_ci
59462306a36Sopenharmony_ciextern unsigned int ti_emif_sram;
59562306a36Sopenharmony_ciextern unsigned int ti_emif_sram_sz;
59662306a36Sopenharmony_ciextern struct ti_emif_pm_data ti_emif_pm_sram_data;
59762306a36Sopenharmony_ciextern struct emif_regs_amx3 ti_emif_regs_amx3;
59862306a36Sopenharmony_ci
59962306a36Sopenharmony_civoid ti_emif_save_context(void);
60062306a36Sopenharmony_civoid ti_emif_restore_context(void);
60162306a36Sopenharmony_civoid ti_emif_run_hw_leveling(void);
60262306a36Sopenharmony_civoid ti_emif_enter_sr(void);
60362306a36Sopenharmony_civoid ti_emif_exit_sr(void);
60462306a36Sopenharmony_civoid ti_emif_abort_sr(void);
60562306a36Sopenharmony_ci
60662306a36Sopenharmony_ci#endif /* __ASSEMBLY__ */
60762306a36Sopenharmony_ci#endif /* __EMIF_H */
608