aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/gpmc.h
diff options
context:
space:
mode:
authorAfzal Mohammed <afzal@ti.com>2012-08-02 10:32:10 -0400
committerAfzal Mohammed <afzal@ti.com>2012-11-09 07:37:11 -0500
commit246da26d37311cd1b1489575f305042dcdecfd50 (patch)
treeeefb42b4e84cdc1ee8b0f984eba17aca8ba036ce /arch/arm/mach-omap2/gpmc.h
parent559d94b00c4dca74b060bae1feeb81cac38628a6 (diff)
ARM: OMAP2+: gpmc: generic timing calculation
Presently there are three peripherals that gets it timing by runtime calculation. Those peripherals can work with frequency scaling that affects gpmc clock. But timing calculation for them are in different ways. Here a generic runtime calculation method is proposed. Input to this function were selected so that they represent timing variables that are present in peripheral datasheets. Motive behind this was to achieve DT bindings for the inputs as is. Even though a few of the tusb6010 timings could not be made directly related to timings normally found on peripherals, expressions used were translated to those that could be justified. There are possibilities of improving the calculations, like calculating timing for read & write operations in a more similar way. Expressions derived here were tested for async onenand on omap3evm (as vanilla Kernel does not have omap3evm onenand support, local patch was used). Other peripherals, tusb6010, smc91x calculations were validated by simulating on omap3evm. Regarding "we_on" for onenand async, it was found that even for muxed address/data, it need not be greater than "adv_wr_off", but rather could be derived from write setup time for peripheral from start of access time, hence would more be in line with peripheral timings. With this method it was working fine. If it is required in some cases to have "we_on" same as "wr_data_mux_bus" (i.e. greater than "adv_wr_off"), another variable could be added to indicate it. But such a requirement is not expected though. It has been observed that "adv_rd_off" & "adv_wr_off" are currently calculated by adding an offset over "oe_on" and "we_on" respectively in the case of smc91x. But peripheral datasheet does not specify so and so "adv_rd(wr)_off" has been derived (to be specific, made ignorant of "oe_on" and "we_on") observing datasheet rather than adding an offset. Hence this generic routine is expected to work for smc91x (91C96 RX51 board). This was verified on smsc911x (9220 on OMAP3EVM) - a similar ethernet controller. Timings are calculated in ps to prevent rounding errors and converted to ns at final stage so that these values can be directly fed to gpmc_cs_set_timings(). gpmc_cs_set_timings() would be modified to take ps once all custom timing routines are replaced by the generic routine, at the same time generic timing routine would be modified to provide timings in ps. struct gpmc_timings field types are upgraded from u16 => u32 so that it can hold ps values. Whole of this exercise is being done to achieve driver and DT conversion. If timings could not be calculated in a peripheral agnostic way, either gpmc driver would have to be peripheral gnostic or a wrapper arrangement over gpmc driver would be required. Signed-off-by: Afzal Mohammed <afzal@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/gpmc.h')
-rw-r--r--arch/arm/mach-omap2/gpmc.h102
1 files changed, 82 insertions, 20 deletions
diff --git a/arch/arm/mach-omap2/gpmc.h b/arch/arm/mach-omap2/gpmc.h
index e08a51a7a76a..fe0a844d5007 100644
--- a/arch/arm/mach-omap2/gpmc.h
+++ b/arch/arm/mach-omap2/gpmc.h
@@ -94,42 +94,104 @@ struct gpmc_timings {
94 u32 sync_clk; 94 u32 sync_clk;
95 95
96 /* Chip-select signal timings corresponding to GPMC_CS_CONFIG2 */ 96 /* Chip-select signal timings corresponding to GPMC_CS_CONFIG2 */
97 u16 cs_on; /* Assertion time */ 97 u32 cs_on; /* Assertion time */
98 u16 cs_rd_off; /* Read deassertion time */ 98 u32 cs_rd_off; /* Read deassertion time */
99 u16 cs_wr_off; /* Write deassertion time */ 99 u32 cs_wr_off; /* Write deassertion time */
100 100
101 /* ADV signal timings corresponding to GPMC_CONFIG3 */ 101 /* ADV signal timings corresponding to GPMC_CONFIG3 */
102 u16 adv_on; /* Assertion time */ 102 u32 adv_on; /* Assertion time */
103 u16 adv_rd_off; /* Read deassertion time */ 103 u32 adv_rd_off; /* Read deassertion time */
104 u16 adv_wr_off; /* Write deassertion time */ 104 u32 adv_wr_off; /* Write deassertion time */
105 105
106 /* WE signals timings corresponding to GPMC_CONFIG4 */ 106 /* WE signals timings corresponding to GPMC_CONFIG4 */
107 u16 we_on; /* WE assertion time */ 107 u32 we_on; /* WE assertion time */
108 u16 we_off; /* WE deassertion time */ 108 u32 we_off; /* WE deassertion time */
109 109
110 /* OE signals timings corresponding to GPMC_CONFIG4 */ 110 /* OE signals timings corresponding to GPMC_CONFIG4 */
111 u16 oe_on; /* OE assertion time */ 111 u32 oe_on; /* OE assertion time */
112 u16 oe_off; /* OE deassertion time */ 112 u32 oe_off; /* OE deassertion time */
113 113
114 /* Access time and cycle time timings corresponding to GPMC_CONFIG5 */ 114 /* Access time and cycle time timings corresponding to GPMC_CONFIG5 */
115 u16 page_burst_access; /* Multiple access word delay */ 115 u32 page_burst_access; /* Multiple access word delay */
116 u16 access; /* Start-cycle to first data valid delay */ 116 u32 access; /* Start-cycle to first data valid delay */
117 u16 rd_cycle; /* Total read cycle time */ 117 u32 rd_cycle; /* Total read cycle time */
118 u16 wr_cycle; /* Total write cycle time */ 118 u32 wr_cycle; /* Total write cycle time */
119 119
120 u16 bus_turnaround; 120 u32 bus_turnaround;
121 u16 cycle2cycle_delay; 121 u32 cycle2cycle_delay;
122 122
123 u16 wait_monitoring; 123 u32 wait_monitoring;
124 u16 clk_activation; 124 u32 clk_activation;
125 125
126 /* The following are only on OMAP3430 */ 126 /* The following are only on OMAP3430 */
127 u16 wr_access; /* WRACCESSTIME */ 127 u32 wr_access; /* WRACCESSTIME */
128 u16 wr_data_mux_bus; /* WRDATAONADMUXBUS */ 128 u32 wr_data_mux_bus; /* WRDATAONADMUXBUS */
129 129
130 struct gpmc_bool_timings bool_timings; 130 struct gpmc_bool_timings bool_timings;
131}; 131};
132 132
133/* Device timings in picoseconds */
134struct gpmc_device_timings {
135 u32 t_ceasu; /* address setup to CS valid */
136 u32 t_avdasu; /* address setup to ADV valid */
137 /* XXX: try to combine t_avdp_r & t_avdp_w. Issue is
138 * of tusb using these timings even for sync whilst
139 * ideally for adv_rd/(wr)_off it should have considered
140 * t_avdh instead. This indirectly necessitates r/w
141 * variations of t_avdp as it is possible to have one
142 * sync & other async
143 */
144 u32 t_avdp_r; /* ADV low time (what about t_cer ?) */
145 u32 t_avdp_w;
146 u32 t_aavdh; /* address hold time */
147 u32 t_oeasu; /* address setup to OE valid */
148 u32 t_aa; /* access time from ADV assertion */
149 u32 t_iaa; /* initial access time */
150 u32 t_oe; /* access time from OE assertion */
151 u32 t_ce; /* access time from CS asertion */
152 u32 t_rd_cycle; /* read cycle time */
153 u32 t_cez_r; /* read CS deassertion to high Z */
154 u32 t_cez_w; /* write CS deassertion to high Z */
155 u32 t_oez; /* OE deassertion to high Z */
156 u32 t_weasu; /* address setup to WE valid */
157 u32 t_wpl; /* write assertion time */
158 u32 t_wph; /* write deassertion time */
159 u32 t_wr_cycle; /* write cycle time */
160
161 u32 clk;
162 u32 t_bacc; /* burst access valid clock to output delay */
163 u32 t_ces; /* CS setup time to clk */
164 u32 t_avds; /* ADV setup time to clk */
165 u32 t_avdh; /* ADV hold time from clk */
166 u32 t_ach; /* address hold time from clk */
167 u32 t_rdyo; /* clk to ready valid */
168
169 u32 t_ce_rdyz; /* XXX: description ?, or use t_cez instead */
170 u32 t_ce_avd; /* CS on to ADV on delay */
171
172 /* XXX: check the possibility of combining
173 * cyc_aavhd_oe & cyc_aavdh_we
174 */
175 u8 cyc_aavdh_oe;/* read address hold time in cycles */
176 u8 cyc_aavdh_we;/* write address hold time in cycles */
177 u8 cyc_oe; /* access time from OE assertion in cycles */
178 u8 cyc_wpl; /* write deassertion time in cycles */
179 u32 cyc_iaa; /* initial access time in cycles */
180
181 bool mux; /* address & data muxed */
182 bool sync_write;/* synchronous write */
183 bool sync_read; /* synchronous read */
184
185 /* extra delays */
186 bool ce_xdelay;
187 bool avd_xdelay;
188 bool oe_xdelay;
189 bool we_xdelay;
190};
191
192extern int gpmc_calc_timings(struct gpmc_timings *gpmc_t,
193 struct gpmc_device_timings *dev_t);
194
133extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs); 195extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs);
134extern int gpmc_get_client_irq(unsigned irq_config); 196extern int gpmc_get_client_irq(unsigned irq_config);
135 197