xref: /linux/include/linux/platform_data/emif_plat.h (revision d0b73b488c55df905ea8faaad079f8535629ed26)
1 /*
2  * Definitions for TI EMIF device platform data
3  *
4  * Copyright (C) 2012 Texas Instruments, Inc.
5  *
6  * Aneesh V <aneesh@ti.com>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  */
12 #ifndef __EMIF_PLAT_H
13 #define __EMIF_PLAT_H
14 
15 /* Low power modes - EMIF_PWR_MGMT_CTRL */
16 #define EMIF_LP_MODE_DISABLE				0
17 #define EMIF_LP_MODE_CLOCK_STOP				1
18 #define EMIF_LP_MODE_SELF_REFRESH			2
19 #define EMIF_LP_MODE_PWR_DN				4
20 
21 /* Hardware capabilities */
22 #define	EMIF_HW_CAPS_LL_INTERFACE			0x00000001
23 
24 /*
25  * EMIF IP Revisions
26  *	EMIF4D  - Used in OMAP4
27  *	EMIF4D5 - Used in OMAP5
28  */
29 #define	EMIF_4D						1
30 #define	EMIF_4D5					2
31 
32 /*
33  * PHY types
34  *	ATTILAPHY  - Used in OMAP4
35  *	INTELLIPHY - Used in OMAP5
36  */
37 #define	EMIF_PHY_TYPE_ATTILAPHY				1
38 #define	EMIF_PHY_TYPE_INTELLIPHY			2
39 
40 /* Custom config requests */
41 #define EMIF_CUSTOM_CONFIG_LPMODE			0x00000001
42 #define EMIF_CUSTOM_CONFIG_TEMP_ALERT_POLL_INTERVAL	0x00000002
43 
44 #ifndef __ASSEMBLY__
45 /**
46  * struct ddr_device_info - All information about the DDR device except AC
47  *		timing parameters
48  * @type:	Device type (LPDDR2-S4, LPDDR2-S2 etc)
49  * @density:	Device density
50  * @io_width:	Bus width
51  * @cs1_used:	Whether there is a DDR device attached to the second
52  *		chip-select(CS1) of this EMIF instance
53  * @cal_resistors_per_cs: Whether there is one calibration resistor per
54  *		chip-select or whether it's a single one for both
55  * @manufacturer: Manufacturer name string
56  */
57 struct ddr_device_info {
58 	u32	type;
59 	u32	density;
60 	u32	io_width;
61 	u32	cs1_used;
62 	u32	cal_resistors_per_cs;
63 	char	manufacturer[10];
64 };
65 
66 /**
67  * struct emif_custom_configs - Custom configuration parameters/policies
68  *		passed from the platform layer
69  * @mask:	Mask to indicate which configs are requested
70  * @lpmode:	LPMODE to be used in PWR_MGMT_CTRL register
71  * @lpmode_timeout_performance: Timeout before LPMODE entry when higher
72  *		performance is desired at the cost of power (typically
73  *		at higher OPPs)
74  * @lpmode_timeout_power: Timeout before LPMODE entry when better power
75  *		savings is desired and performance is not important
76  *		(typically at lower loads indicated by lower OPPs)
77  * @lpmode_freq_threshold: The DDR frequency threshold to identify between
78  *		the above two cases:
79  *		timeout = (freq >= lpmode_freq_threshold) ?
80  *			lpmode_timeout_performance :
81  *			lpmode_timeout_power;
82  * @temp_alert_poll_interval_ms: LPDDR2 MR4 polling interval at nominal
83  *		temperature(in milliseconds). When temperature is high
84  *		polling is done 4 times as frequently.
85  */
86 struct emif_custom_configs {
87 	u32 mask;
88 	u32 lpmode;
89 	u32 lpmode_timeout_performance;
90 	u32 lpmode_timeout_power;
91 	u32 lpmode_freq_threshold;
92 	u32 temp_alert_poll_interval_ms;
93 };
94 
95 /**
96  * struct emif_platform_data - Platform data passed on EMIF platform
97  *				device creation. Used by the driver.
98  * @hw_caps:		Hw capabilities of the EMIF IP in the respective SoC
99  * @device_info:	Device info structure containing information such
100  *			as type, bus width, density etc
101  * @timings:		Timings information from device datasheet passed
102  *			as an array of 'struct lpddr2_timings'. Can be NULL
103  *			if if default timings are ok
104  * @timings_arr_size:	Size of the timings array. Depends on the number
105  *			of different frequencies for which timings data
106  *			is provided
107  * @min_tck:		Minimum value of some timing parameters in terms
108  *			of number of cycles. Can be NULL if default values
109  *			are ok
110  * @custom_configs:	Custom configurations requested by SoC or board
111  *			code and the data for them. Can be NULL if default
112  *			configurations done by the driver are ok. See
113  *			documentation for 'struct emif_custom_configs' for
114  *			more details
115  */
116 struct emif_platform_data {
117 	u32 hw_caps;
118 	struct ddr_device_info *device_info;
119 	const struct lpddr2_timings *timings;
120 	u32 timings_arr_size;
121 	const struct lpddr2_min_tck *min_tck;
122 	struct emif_custom_configs *custom_configs;
123 	u32 ip_rev;
124 	u32 phy_type;
125 };
126 #endif /* __ASSEMBLY__ */
127 
128 #endif /* __LINUX_EMIF_H */
129