162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Definitions for TI EMIF device platform data
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2012 Texas Instruments, Inc.
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Aneesh V <aneesh@ti.com>
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci#ifndef __EMIF_PLAT_H
1062306a36Sopenharmony_ci#define __EMIF_PLAT_H
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci/* Low power modes - EMIF_PWR_MGMT_CTRL */
1362306a36Sopenharmony_ci#define EMIF_LP_MODE_DISABLE				0
1462306a36Sopenharmony_ci#define EMIF_LP_MODE_CLOCK_STOP				1
1562306a36Sopenharmony_ci#define EMIF_LP_MODE_SELF_REFRESH			2
1662306a36Sopenharmony_ci#define EMIF_LP_MODE_PWR_DN				4
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci/* Hardware capabilities */
1962306a36Sopenharmony_ci#define	EMIF_HW_CAPS_LL_INTERFACE			0x00000001
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/*
2262306a36Sopenharmony_ci * EMIF IP Revisions
2362306a36Sopenharmony_ci *	EMIF4D  - Used in OMAP4
2462306a36Sopenharmony_ci *	EMIF4D5 - Used in OMAP5
2562306a36Sopenharmony_ci */
2662306a36Sopenharmony_ci#define	EMIF_4D						1
2762306a36Sopenharmony_ci#define	EMIF_4D5					2
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci/*
3062306a36Sopenharmony_ci * PHY types
3162306a36Sopenharmony_ci *	ATTILAPHY  - Used in OMAP4
3262306a36Sopenharmony_ci *	INTELLIPHY - Used in OMAP5
3362306a36Sopenharmony_ci */
3462306a36Sopenharmony_ci#define	EMIF_PHY_TYPE_ATTILAPHY				1
3562306a36Sopenharmony_ci#define	EMIF_PHY_TYPE_INTELLIPHY			2
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/* Custom config requests */
3862306a36Sopenharmony_ci#define EMIF_CUSTOM_CONFIG_LPMODE			0x00000001
3962306a36Sopenharmony_ci#define EMIF_CUSTOM_CONFIG_TEMP_ALERT_POLL_INTERVAL	0x00000002
4062306a36Sopenharmony_ci#define EMIF_CUSTOM_CONFIG_EXTENDED_TEMP_PART		0x00000004
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci#ifndef __ASSEMBLY__
4362306a36Sopenharmony_ci/**
4462306a36Sopenharmony_ci * struct ddr_device_info - All information about the DDR device except AC
4562306a36Sopenharmony_ci *		timing parameters
4662306a36Sopenharmony_ci * @type:	Device type (LPDDR2-S4, LPDDR2-S2 etc)
4762306a36Sopenharmony_ci * @density:	Device density
4862306a36Sopenharmony_ci * @io_width:	Bus width
4962306a36Sopenharmony_ci * @cs1_used:	Whether there is a DDR device attached to the second
5062306a36Sopenharmony_ci *		chip-select(CS1) of this EMIF instance
5162306a36Sopenharmony_ci * @cal_resistors_per_cs: Whether there is one calibration resistor per
5262306a36Sopenharmony_ci *		chip-select or whether it's a single one for both
5362306a36Sopenharmony_ci * @manufacturer: Manufacturer name string
5462306a36Sopenharmony_ci */
5562306a36Sopenharmony_cistruct ddr_device_info {
5662306a36Sopenharmony_ci	u32	type;
5762306a36Sopenharmony_ci	u32	density;
5862306a36Sopenharmony_ci	u32	io_width;
5962306a36Sopenharmony_ci	u32	cs1_used;
6062306a36Sopenharmony_ci	u32	cal_resistors_per_cs;
6162306a36Sopenharmony_ci	char	manufacturer[10];
6262306a36Sopenharmony_ci};
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci/**
6562306a36Sopenharmony_ci * struct emif_custom_configs - Custom configuration parameters/policies
6662306a36Sopenharmony_ci *		passed from the platform layer
6762306a36Sopenharmony_ci * @mask:	Mask to indicate which configs are requested
6862306a36Sopenharmony_ci * @lpmode:	LPMODE to be used in PWR_MGMT_CTRL register
6962306a36Sopenharmony_ci * @lpmode_timeout_performance: Timeout before LPMODE entry when higher
7062306a36Sopenharmony_ci *		performance is desired at the cost of power (typically
7162306a36Sopenharmony_ci *		at higher OPPs)
7262306a36Sopenharmony_ci * @lpmode_timeout_power: Timeout before LPMODE entry when better power
7362306a36Sopenharmony_ci *		savings is desired and performance is not important
7462306a36Sopenharmony_ci *		(typically at lower loads indicated by lower OPPs)
7562306a36Sopenharmony_ci * @lpmode_freq_threshold: The DDR frequency threshold to identify between
7662306a36Sopenharmony_ci *		the above two cases:
7762306a36Sopenharmony_ci *		timeout = (freq >= lpmode_freq_threshold) ?
7862306a36Sopenharmony_ci *			lpmode_timeout_performance :
7962306a36Sopenharmony_ci *			lpmode_timeout_power;
8062306a36Sopenharmony_ci * @temp_alert_poll_interval_ms: LPDDR2 MR4 polling interval at nominal
8162306a36Sopenharmony_ci *		temperature(in milliseconds). When temperature is high
8262306a36Sopenharmony_ci *		polling is done 4 times as frequently.
8362306a36Sopenharmony_ci */
8462306a36Sopenharmony_cistruct emif_custom_configs {
8562306a36Sopenharmony_ci	u32 mask;
8662306a36Sopenharmony_ci	u32 lpmode;
8762306a36Sopenharmony_ci	u32 lpmode_timeout_performance;
8862306a36Sopenharmony_ci	u32 lpmode_timeout_power;
8962306a36Sopenharmony_ci	u32 lpmode_freq_threshold;
9062306a36Sopenharmony_ci	u32 temp_alert_poll_interval_ms;
9162306a36Sopenharmony_ci};
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci/**
9462306a36Sopenharmony_ci * struct emif_platform_data - Platform data passed on EMIF platform
9562306a36Sopenharmony_ci *				device creation. Used by the driver.
9662306a36Sopenharmony_ci * @hw_caps:		Hw capabilities of the EMIF IP in the respective SoC
9762306a36Sopenharmony_ci * @device_info:	Device info structure containing information such
9862306a36Sopenharmony_ci *			as type, bus width, density etc
9962306a36Sopenharmony_ci * @timings:		Timings information from device datasheet passed
10062306a36Sopenharmony_ci *			as an array of 'struct lpddr2_timings'. Can be NULL
10162306a36Sopenharmony_ci *			if if default timings are ok
10262306a36Sopenharmony_ci * @timings_arr_size:	Size of the timings array. Depends on the number
10362306a36Sopenharmony_ci *			of different frequencies for which timings data
10462306a36Sopenharmony_ci *			is provided
10562306a36Sopenharmony_ci * @min_tck:		Minimum value of some timing parameters in terms
10662306a36Sopenharmony_ci *			of number of cycles. Can be NULL if default values
10762306a36Sopenharmony_ci *			are ok
10862306a36Sopenharmony_ci * @custom_configs:	Custom configurations requested by SoC or board
10962306a36Sopenharmony_ci *			code and the data for them. Can be NULL if default
11062306a36Sopenharmony_ci *			configurations done by the driver are ok. See
11162306a36Sopenharmony_ci *			documentation for 'struct emif_custom_configs' for
11262306a36Sopenharmony_ci *			more details
11362306a36Sopenharmony_ci */
11462306a36Sopenharmony_cistruct emif_platform_data {
11562306a36Sopenharmony_ci	u32 hw_caps;
11662306a36Sopenharmony_ci	struct ddr_device_info *device_info;
11762306a36Sopenharmony_ci	const struct lpddr2_timings *timings;
11862306a36Sopenharmony_ci	u32 timings_arr_size;
11962306a36Sopenharmony_ci	const struct lpddr2_min_tck *min_tck;
12062306a36Sopenharmony_ci	struct emif_custom_configs *custom_configs;
12162306a36Sopenharmony_ci	u32 ip_rev;
12262306a36Sopenharmony_ci	u32 phy_type;
12362306a36Sopenharmony_ci};
12462306a36Sopenharmony_ci#endif /* __ASSEMBLY__ */
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci#endif /* __LINUX_EMIF_H */
127