gpmc.h 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  1. /**
  2. * \file gpmc.h
  3. *
  4. * \brief Definitions used for GPMC
  5. *
  6. * This file contains the driver API prototypes and macro definitions.
  7. */
  8. /*
  9. * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
  10. */
  11. /*
  12. * Redistribution and use in source and binary forms, with or without
  13. * modification, are permitted provided that the following conditions
  14. * are met:
  15. *
  16. * Redistributions of source code must retain the above copyright
  17. * notice, this list of conditions and the following disclaimer.
  18. *
  19. * Redistributions in binary form must reproduce the above copyright
  20. * notice, this list of conditions and the following disclaimer in the
  21. * documentation and/or other materials provided with the
  22. * distribution.
  23. *
  24. * Neither the name of Texas Instruments Incorporated nor the names of
  25. * its contributors may be used to endorse or promote products derived
  26. * from this software without specific prior written permission.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  29. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  30. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  31. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  32. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  33. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  34. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  35. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  36. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  37. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  38. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  39. *
  40. */
  41. #ifndef __GPMC_H_
  42. #define __GPMC_H__
  43. #include "hw_gpmc.h"
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47. /*******************************************************************************
  48. * MACRO DEFINITIONS
  49. *******************************************************************************/
  50. /*****************************************************************************/
  51. /*
  52. ** Macros which can be used as 'mode' parameter to GPMCIdleModeSelect API.
  53. **
  54. */
  55. #define GPMC_IDLEMODE_FORCEIDLE (0)
  56. #define GPMC_IDLEMODE_NOIDLE (1)
  57. #define GPMC_IDLEMODE_SMARTIDLE (2)
  58. /*****************************************************************************/
  59. /*
  60. ** Macros which can be used as 'configVal' parameter to GPMCAutoIdleConfig API.
  61. **
  62. */
  63. #define GPMC_AUTOIDLE_FREERUN (0)
  64. #define GPMC_AUTOIDLE_AUTORUN (1)
  65. /*****************************************************************************/
  66. /*
  67. ** Macros which can be used as 'flag' parameter to GPMCIntStatusGet,
  68. ** GPMCIntStatusClear APIs.
  69. **
  70. */
  71. #define GPMC_FIFOEVENT_STATUS (0)
  72. #define GPMC_TERMINALCOUNT_STATUS (1)
  73. #define GPMC_WAIT0EDGEDETECTION_STATUS (2)
  74. #define GPMC_WAIT1EDGEDETECTION_STATUS (3)
  75. /*****************************************************************************/
  76. /*
  77. ** Macros which can be used as 'flag' parameter to GPMCIntEnable, GPMCIntDisable
  78. ** APIs.
  79. **
  80. */
  81. #define GPMC_FIFOEVENT_INT (0)
  82. #define GPMC_TERMINALCOUNT_INT (1)
  83. #define GPMC_WAIT0EDGEDETECTION_INT (2)
  84. #define GPMC_WAIT1EDGEDETECTION_INT (3)
  85. /*****************************************************************************/
  86. /*
  87. ** Macros which can be used as 'flag' parameter to GPMCTimeOutFeatureConfig API.
  88. **
  89. */
  90. #define GPMC_TIMEOUTFEATURE_ENABLE (1)
  91. #define GPMC_TIMEOUTFEATURE_DISABLE (0)
  92. /*****************************************************************************/
  93. /*
  94. ** Macros which can be used as 'err' parameter to GPMCErrStatusGet API.
  95. **
  96. */
  97. #define GPMC_TIMEOUT_ERROR (0)
  98. #define GPMC_NOTSUPPMCMD_ERROR (1)
  99. #define GPMC_NOTSUPPADD_ERROR (2)
  100. /*****************************************************************************/
  101. /*
  102. ** Macros which can be used as 'pin' parameter to GPMCWaitPinPolaritySelect,
  103. ** GPMCWaitPinStatusGet APIs.
  104. **
  105. */
  106. #define GPMC_WAIT_PIN0 (0)
  107. #define GPMC_WAIT_PIN1 (1)
  108. /*****************************************************************************/
  109. /*
  110. ** Macros which can be used as 'polarity' parameter to GPMCWaitPinPolaritySelect
  111. ** API.
  112. **
  113. */
  114. #define GPMC_WAIT_PIN_POLARITY_LOW (0)
  115. #define GPMC_WAIT_PIN_POLARITY_HIGH (1)
  116. /*****************************************************************************/
  117. /*
  118. ** Macros which can be used as 'pinLevel' parameter to
  119. ** GPMCWriteProtectPinLevelCntrl API.
  120. */
  121. #define GPMC_WP_PIN_LEVEL_LOW (0)
  122. #define GPMC_WP_PIN_LEVEL_HIGH (1)
  123. /*****************************************************************************/
  124. /*
  125. ** Macros which can be used as 'flag' parameter to
  126. ** GPMCNANDForcePostedWriteFeatureConfig API.
  127. */
  128. #define GPMC_FORCEPOSTEDWRITE_ENABLE (1)
  129. #define GPMC_FORCEPOSTEDWRITE_DISABLE (0)
  130. /*****************************************************************************/
  131. /*
  132. ** Macros which can be used as 'flag' parameter to
  133. ** GPMCLimitedAddrDevSupportConfig API.
  134. */
  135. #define GPMC_LIMITEDADDRESS_SUPPORT_ENABLE (1)
  136. #define GPMC_LIMITEDADDRESS_SUPPORT_DISABLE (0)
  137. /*****************************************************************************/
  138. /*
  139. ** Macros which can be used as 'csNum' parameter to GPMCFclkDividerSelect,
  140. ** GPMCTimeParaGranularitySelect, GPMCAddrDataMuxProtocolSelect,
  141. ** GPMCDevTypeSelect, GPMCDevSizeSelect, GPMCWaitPinSelect,
  142. ** GPMCWaitMonitoringTimeSelect, GPMCWaitPinMonitoringConfig,
  143. ** GPMCClkActivationTimeConfig, GPMCDevPageLenSet, GPMCWriteTypeSelect,
  144. ** GPMCReadTypeSelect, GPMCAccessTypeSelect, GPMCSyncWrapBurstConfig,
  145. ** GPMCCSTimingConfig, GPMCADVTimingConfig, GPMCWEAndOETimingConfig,
  146. ** GPMCRdAccessAndCycleTimeTimingConfig, GPMCCSConfig, GPMCBaseAddrSet,
  147. ** GPMCWrAccessAndWrDataOnADMUXBusTimingConfig, GPMCMaskAddrSet,
  148. ** GPMCycle2CycleAndTurnArndTimeTimingConfig, GPMCSNANDCmdWrite,
  149. ** GPMCNANDAddrWrite, GPMCNANDDataWrite, GPMCNANDDataRead, GPMCPrefetchCSSelect,
  150. ** GPMCECCCSSelect, GPMCECCBCHResultGet APIs.
  151. **
  152. */
  153. #define GPMC_CHIP_SELECT_0 (0)
  154. #define GPMC_CHIP_SELECT_1 (1)
  155. #define GPMC_CHIP_SELECT_2 (2)
  156. #define GPMC_CHIP_SELECT_3 (3)
  157. #define GPMC_CHIP_SELECT_4 (4)
  158. #define GPMC_CHIP_SELECT_5 (5)
  159. #define GPMC_CHIP_SELECT_6 (6)
  160. #define GPMC_CHIP_SELECT_7 (7)
  161. /*****************************************************************************/
  162. /*
  163. ** Macros which can be used as 'divideVal' parameter to GPMCFclkDividerSelect
  164. ** API.
  165. **
  166. */
  167. #define GPMC_FCLK_DIV_BY_1 (0)
  168. #define GPMC_FCLK_DIV_BY_2 (1)
  169. #define GPMC_FCLK_DIV_BY_3 (2)
  170. #define GPMC_FCLK_DIV_BY_4 (3)
  171. /*****************************************************************************/
  172. /*
  173. ** Macros which can be used as 'scaleftr' parameter to
  174. ** GPMCTimeparaGranularitySelect API.
  175. **
  176. */
  177. #define GPMC_TIMEPARAGRANULARITY_X1 (0)
  178. #define GPMC_TIMEPARAGRANULARITY_X2 (1)
  179. /*****************************************************************************/
  180. /*
  181. ** Macros which can be used as 'protocol' parameter to
  182. ** GPMCAddrDataMuxProtocolSelect API.
  183. **
  184. */
  185. #define GPMC_MUXADDDATA_NOMUX (0)
  186. #define GPMC_MUXADDDATA_AADMUX (1)
  187. #define GPMC_MUXADDDATA_ADMUX (2)
  188. /*****************************************************************************/
  189. /*
  190. ** Macros which can be used as 'devType' parameter to GPMCDevTypeSelect API.
  191. **
  192. */
  193. #define GPMC_DEVICETYPE_NORLIKE (0)
  194. #define GPMC_DEVICETYPE_NANDLIKE (2)
  195. /*****************************************************************************/
  196. /*
  197. ** Macros which can be used as 'devSize' parameter to GPMCDevSizeSelect API.
  198. **
  199. */
  200. #define GPMC_DEVICESIZE_8BITS (0)
  201. #define GPMC_DEVICESIZE_16BITS (1)
  202. /*****************************************************************************/
  203. /*
  204. ** Macros which can be used as 'flag' parameter to GPMCWaitMonitoringTimeSelect
  205. ** API.
  206. **
  207. */
  208. #define GPMC_WAITMONITORINGTIME_WITH_VALIDDATA (0)
  209. #define GPMC_WAITMONITORINGTIME_ONECLKB4_VALIDDATA (1)
  210. #define GPMC_WAITMONITORINGTIME_TWOCLKB4_VALIDDATA (2)
  211. /*****************************************************************************/
  212. /*
  213. ** Macros which can be used as 'mode' parameter to GPMCWaitPinMonitoringConfig
  214. ** API.
  215. **
  216. */
  217. #define GPMC_MODE_READ (0)
  218. #define GPMC_MODE_WRITE (1)
  219. /*****************************************************************************/
  220. /*
  221. ** Macros which can be used as 'flag' parameter to GPMCWaitMonitoringTimeConfig
  222. ** API.
  223. **
  224. */
  225. #define GPMC_WAITMONITORING_ENABLE (1)
  226. #define GPMC_WAITMONITORING_DISABLE (0)
  227. /*****************************************************************************/
  228. /*
  229. ** Macros which can be used as 'flag' parameter to GPMCClkActivationTimeConfig
  230. ** API.
  231. **
  232. */
  233. #define GPMC_CLKACTIVATIONTIME_ATSTART (0)
  234. #define GPMC_CLKACTIVATIONTIME_ONECLK_AFTR (1)
  235. #define GPMC_CLKACTIVATIONTIME_TWOCLK_AFTR (2)
  236. /*****************************************************************************/
  237. /*
  238. ** Macros which can be used as 'pageLen' parameter to GPMCDevPageLenSet API.
  239. **
  240. */
  241. #define GPMC_DEV_PAGELENGTH_FOUR (0)
  242. #define GPMC_DEV_PAGELENGTH_EIGHT (1)
  243. #define GPMC_DEV_PAGELENGTH_SIXTEEN (2)
  244. /*****************************************************************************/
  245. /*
  246. ** Macros which can be used as 'writeType' parameter to GPMCWriteTypeSelect API.
  247. **
  248. */
  249. #define GPMC_WRITETYPE_ASYNC (0)
  250. #define GPMC_WRITETYPE_SYNC (1)
  251. /*****************************************************************************/
  252. /*
  253. ** Macros which can be used as 'readType' parameter to GPMCReadTypeSelect API.
  254. **
  255. */
  256. #define GPMC_READTYPE_ASYNC (0)
  257. #define GPMC_READTYPE_SYNC (1)
  258. /*****************************************************************************/
  259. /*
  260. ** Macros which can be used as 'AccessType' parameter to GPMCAccessTypeSelect
  261. ** API.
  262. **
  263. */
  264. #define GPMC_ACCESSTYPE_SINGLE (0)
  265. #define GPMC_ACCESSTYPE_MULTIPLE (1)
  266. /*****************************************************************************/
  267. /*
  268. ** Macros which can be used as 'flag' parameter to GPMCSyncWrapBurstConfig API.
  269. **
  270. */
  271. #define GPMC_WRAPBURST_ENABLE (1)
  272. #define GPMC_WRAPBURST_DISABLE (0)
  273. /*****************************************************************************/
  274. /*
  275. ** Macros which can be used as 'CSExtDelayFlag' parameter to
  276. ** GPMC_CS_TIMING_CONFIG macro
  277. */
  278. #define GPMC_CS_EXTRA_DELAY (1)
  279. #define GPMC_CS_EXTRA_NODELAY (0)
  280. /*
  281. * \brief This macro used to make the conf value which is used to configure the
  282. * CS signal timing configuration.\n
  283. *
  284. * \param CSWrOffTime CS# de-assertion time from start cycle time for write
  285. * accesses in GPMC_FCLK cycles.
  286. *
  287. * CSRdOffTime CS# de-assertion time from start cycle time for read
  288. * accesses in GPMC_FCLK cycles
  289. *
  290. * CSExtDelayFlag Flag to indicate whether to add half GPMC_FCLK delay to
  291. * CS or not.
  292. * This can take one of the following values :
  293. * GPMC_CS_EXTRA_DELAY -- CS# Timing control
  294. * signal is delayed of
  295. * half GPMC_FCLK cycle.
  296. * GPMC_CS_EXTRA_NODELAY -- CS# Timing control
  297. * signal is not delayed
  298. *
  299. * CSOnTime CS# assertion time from start cycle time in GPMC_FCLK
  300. * cycles.
  301. */
  302. #define GPMC_CS_TIMING_CONFIG(CSWrOffTime, CSRdOffTime, CSExtDelayFlag, CSOnTime ) ((unsigned int) \
  303. ((CSWrOffTime << GPMC_CONFIG2_0_CSWROFFTIME_SHIFT) & GPMC_CONFIG2_0_CSWROFFTIME) | \
  304. ((CSRdOffTime << GPMC_CONFIG2_0_CSRDOFFTIME_SHIFT) & GPMC_CONFIG2_0_CSRDOFFTIME) | \
  305. ((CSExtDelayFlag << GPMC_CONFIG2_0_CSEXTRADELAY_SHIFT) & GPMC_CONFIG2_0_CSEXTRADELAY) | \
  306. ((CSOnTime << GPMC_CONFIG2_0_CSONTIME_SHIFT) & GPMC_CONFIG2_0_CSONTIME))
  307. /*****************************************************************************/
  308. /*
  309. ** Macros which can be used as 'ADVExtDelayFlag' parameter to
  310. ** GPMC_ADV_TIMING_CONFIG macro
  311. */
  312. #define GPMC_ADV_EXTRA_DELAY (1)
  313. #define GPMC_ADV_EXTRA_NODELAY (0)
  314. /*
  315. * \brief This macro used to make the conf value which is used to configure the
  316. * ADV# signal timing configuration.\n
  317. *
  318. * \param ADVAADMuxWrOffTime ADV# de-assertion time in GPMC_FCLK cycles for
  319. * first address phase when using the AAD-Mux
  320. * prorocol.
  321. *
  322. * ADVAADMuxRdOffTime ADV# de-assertion time in GPMC_FCLK cycles for
  323. * first address phase when using the AAD-Mux
  324. * prorocol.
  325. *
  326. * ADVWrOffTime ADV# de-assertion time in GPMC_FCLK cycles from
  327. * start cycle time for write accesses
  328. *
  329. * ADVRdOffTime ADV# de-assertion time in GPMC_FCLK cycles from
  330. * start cycle time for write accesses
  331. *
  332. * ADVExtDelayFlag Flag to indicate whether to add half GPMC_FCLK
  333. * delay to ADV or not.
  334. * This can take one of the following values :
  335. * GPMC_ADV_EXTRA_DELAY -- ADV# Timing control
  336. * signal is delayed of
  337. * half GPMC_FCLK cycle.
  338. * GPMC_ADV_EXTRA_NODELAY -- ADV# Timing control
  339. * signal is not delayed.
  340. *
  341. * ADVAADMuxOnTime ADV# assertion time in GPMC_FCLK cycles for
  342. * first address phase when using the
  343. * AAD-Multiplexed protocol.
  344. *
  345. * ADVOnTime ADV# assertion time from start cycle time in
  346. * GPMC_FCLK cycles.
  347. */
  348. #define GPMC_ADV_TIMING_CONFIG(ADVAADMuxWrOffTime, ADVAADMuxRdOffTime, ADVWrOffTime, ADVRdOffTime, ADVExtDelayFlag, ADVAADMuxOnTime, ADVOnTime) ((unsigned int) \
  349. ((ADVAADMuxWrOffTime << GPMC_CONFIG3_0_ADVAADMUXWROFFTIME_SHIFT) & GPMC_CONFIG3_0_ADVAADMUXWROFFTIME) | \
  350. ((ADVAADMuxRdOffTime << GPMC_CONFIG3_0_ADVAADMUXRDOFFTIME_SHIFT) & GPMC_CONFIG3_0_ADVAADMUXRDOFFTIME) | \
  351. ((ADVWrOffTime << GPMC_CONFIG3_0_ADVWROFFTIME_SHIFT) & GPMC_CONFIG3_0_ADVWROFFTIME) | \
  352. ((ADVRdOffTime << GPMC_CONFIG3_0_ADVRDOFFTIME_SHIFT) & GPMC_CONFIG3_0_ADVRDOFFTIME) | \
  353. ((ADVExtDelayFlag << GPMC_CONFIG3_0_ADVEXTRADELAY_SHIFT) & GPMC_CONFIG3_0_ADVEXTRADELAY) | \
  354. ((ADVAADMuxOnTime << GPMC_CONFIG3_0_ADVAADMUXONTIME_SHIFT) & GPMC_CONFIG3_0_ADVAADMUXONTIME) | \
  355. ((ADVOnTime << GPMC_CONFIG3_0_ADVONTIME_SHIFT) & GPMC_CONFIG3_0_ADVONTIME))
  356. /*****************************************************************************/
  357. /*
  358. ** Macros which can be used as 'OEExtDelayFlag' parameter to
  359. ** GPMC_WE_OE_TIMING_CONFIG macro
  360. */
  361. #define GPMC_OE_EXTRA_DELAY (1)
  362. #define GPMC_OE_EXTRA_NODELAY (0)
  363. /*****************************************************************************/
  364. /*
  365. ** Macros which can be used as 'WEExtDelayFlag' parameter to
  366. ** GPMC_WE_OE_TIMING_CONFIG macro
  367. */
  368. #define GPMC_WE_EXTRA_DELAY (1)
  369. #define GPMC_WE_EXTRA_NODELAY (0)
  370. /*
  371. * \brief This macro used to make the conf value which is used to configure the
  372. * WE# and OE# signal timing configuration.\n
  373. *
  374. * \param WEOffTime WE# de-assertion time in GPMC_FCLK cycles from
  375. * start cycle time.
  376. *
  377. * WEExtDelayFlag Flag to indicate whether to add half GPMC_FCLK
  378. * delay to WE or not.
  379. * This can take one of the following values :
  380. * GPMC_WE_EXTRA_DELAY -- WE# Timing control
  381. * signal is delayed of
  382. * half GPMC_FCLK cycle.
  383. * GPMC_WE_EXTRA_NODELAY -- WE# Timing control
  384. * signal is not delayed
  385. * WEOnTime WE# assertion time in GPMC_FCLK cycles from
  386. * start cycle time.
  387. *
  388. * OEAADMuxOffTime OE# de-assertion time in GPMC_FCLK cycles for
  389. * first address phase when using the AAD-Mux
  390. * prorocol.
  391. *
  392. * OEOffTime OE# de-assertion time in GPMC_FCLK cycles from
  393. * start cycle time.
  394. *
  395. * OEExtDelayFlag Flag to indicate whether to add half GPMC_FCLK
  396. * delay to OE or not.
  397. * This can take one of the following values :
  398. * GPMC_OE_EXTRA_DELAY -- OE# Timing control
  399. * signal is delayed of
  400. * half GPMC_FCLK cycle.
  401. * GPMC_OE_EXTRA_NODELAY -- OE# Timing control
  402. * signal is not delayed
  403. *
  404. * OEAADMuxOnTime OE# assertion time in GPMC_FCLK cycles for
  405. * first address phase when using the AAD-Mux
  406. * prorocol.
  407. *
  408. * OEOnTime OE# assertion time in GPMC_FCLK cycles from
  409. * start cycle time.
  410. *
  411. */
  412. #define GPMC_WE_OE_TIMING_CONFIG(WEOffTime, WEExtDelayFlag, WEOnTime, OEAADMuxOffTime, OEOffTime, OEExtDelayFlag, OEAADMuxOnTime,OEOnTime ) ((unsigned int) \
  413. ((WEOffTime << GPMC_CONFIG4_0_WEOFFTIME_SHIFT) & GPMC_CONFIG4_0_WEOFFTIME) | \
  414. ((WEExtDelayFlag << GPMC_CONFIG4_0_WEEXTRADELAY_SHIFT) & GPMC_CONFIG4_0_WEEXTRADELAY) | \
  415. ((WEOnTime << GPMC_CONFIG4_0_WEONTIME_SHIFT) & GPMC_CONFIG4_0_WEONTIME) | \
  416. ((OEAADMuxOffTime << GPMC_CONFIG4_0_OEAADMUXOFFTIME_SHIFT) & GPMC_CONFIG4_0_OEAADMUXOFFTIME) | \
  417. ((OEOffTime << GPMC_CONFIG4_0_OEOFFTIME_SHIFT) & GPMC_CONFIG4_0_OEOFFTIME) | \
  418. ((OEExtDelayFlag << GPMC_CONFIG4_0_WEEXTRADELAY_SHIFT) & GPMC_CONFIG4_0_WEEXTRADELAY) | \
  419. ((OEAADMuxOnTime << GPMC_CONFIG4_0_OEAADMUXONTIME_SHIFT) & GPMC_CONFIG4_0_OEAADMUXONTIME) | \
  420. ((OEOnTime << GPMC_CONFIG4_0_OEONTIME_SHIFT) & GPMC_CONFIG4_0_OEONTIME))
  421. /*
  422. * \brief This macro used to make the conf value which is used to configure the
  423. * read access and cycle time timing configuration.\n
  424. *
  425. * \param rdCycleTime Total read cycle time in GPMC_FCLK cycles.
  426. *
  427. * wrCycleTime Total write cycle time in GPMC_FCLK cycles.
  428. *
  429. * rdAccessTime Read access time (Delay between start cycle time
  430. * and first data valid) in GPMC_FCLK cycles.
  431. *
  432. * pageBurstAccessTime Page burest access time (Delay between
  433. * successive words in a multiple access)in
  434. * GPMC_FCLK cycles.
  435. *
  436. */
  437. #define GPMC_RDACCESS_CYCLETIME_TIMING_CONFIG(rdCycleTime, wrCycleTime, rdAccessTime, pageBurstAccessTime ) ((unsigned int) \
  438. ((rdCycleTime << GPMC_CONFIG5_0_RDCYCLETIME_SHIFT) & GPMC_CONFIG5_0_RDCYCLETIME) | \
  439. ((wrCycleTime << GPMC_CONFIG5_0_WRCYCLETIME_SHIFT) & GPMC_CONFIG5_0_WRCYCLETIME) | \
  440. ((rdAccessTime << GPMC_CONFIG5_0_RDACCESSTIME_SHIFT) & GPMC_CONFIG5_0_RDACCESSTIME) | \
  441. ((pageBurstAccessTime << GPMC_CONFIG5_0_PAGEBURSTACCESSTIME_SHIFT) & GPMC_CONFIG5_0_PAGEBURSTACCESSTIME))
  442. /*****************************************************************************/
  443. /*
  444. ** Macros which can be used as 'cycle2CycleDelaySameCSCfg' parameter to
  445. ** GPMC_CYCLE2CYCLE_BUSTURNAROUND_TIMING_CONFIG macro
  446. */
  447. #define GPMC_CYCLE2CYCLESAMECSEN_C2CDELAY (1)
  448. #define GPMC_CYCLE2CYCLESAMECSEN_NOC2CDELAY (0)
  449. /*****************************************************************************/
  450. /*
  451. ** Macros which can be used as 'cycle2CycleDelayDiffCSCfg' parameter to
  452. ** GPMC_CYCLE2CYCLE_BUSTURNAROUND_TIMING_CONFIG macro
  453. */
  454. #define GPMC_CYCLE2CYCLEDIFFCSEN_C2CDELAY (1)
  455. #define GPMC_CYCLE2CYCLEDIFFCSEN_NOC2CDELAY (0)
  456. /*
  457. * \brief This macro used to make the conf value which is used to configure the
  458. * cycle to cycle and bus turn around time timing configuration.\n
  459. *
  460. * \param cycle2CycleDelay Cycle to cycle delay (Chip select high pulse
  461. * delay between two successive accesses)in
  462. * GPMC_FCLK cycles.
  463. *
  464. * cycle2CycleDelaySameCSCfg Specified whether to add the cycle to cycle
  465. * delay between two successive accesses or not
  466. * (to the same chip-select).
  467. * This can take one of the following values :
  468. * GPMC_CYCLE2CYCLESAMECSEN_C2CDELAY -- To add
  469. * the delay.
  470. * GPMC_CYCLE2CYCLESAMECSEN_NOC2CDELAY -- Don't
  471. * add the delay.
  472. *
  473. * cycle2CycleDelayDiffCSCfg Specified whether to add the cycle to cycle
  474. * delay between two successive accesses or not
  475. * (to the diffrent chip-select).
  476. * This can take one of the following values :
  477. * GPMC_CYCLE2CYCLEDIFFCSEN_C2CDELAY -- To add
  478. * the delay.
  479. * GPMC_CYCLE2CYCLEDIFFCSEN_NOC2CDELAY -- Don't
  480. * add the delay.
  481. *
  482. * busTAtime Bus turn aroung time between two successive
  483. * accesses to the same chip-select (read to write)
  484. * or to a diff chip-select in GPMC_FCLK cycles.
  485. *
  486. *
  487. */
  488. #define GPMC_CYCLE2CYCLE_BUSTURNAROUND_TIMING_CONFIG(cycle2CycleDelay, cycle2CycleDelaySameCSCfg, cycle2CycleDelayDiffCSCfg, busTAtime ) ((unsigned int) \
  489. ((cycle2CycleDelay << GPMC_CONFIG6_0_CYCLE2CYCLEDELAY_SHIFT) & GPMC_CONFIG6_0_CYCLE2CYCLEDELAY) | \
  490. ((cycle2CycleDelaySameCSCfg << GPMC_CONFIG6_0_CYCLE2CYCLESAMECSEN_SHIFT) & GPMC_CONFIG6_0_CYCLE2CYCLESAMECSEN) | \
  491. ((cycle2CycleDelayDiffCSCfg << GPMC_CONFIG6_0_CYCLE2CYCLEDIFFCSEN_SHIFT) & GPMC_CONFIG6_0_CYCLE2CYCLEDIFFCSEN) | \
  492. ((busTAtime << GPMC_CONFIG6_0_BUSTURNAROUND_SHIFT) & GPMC_CONFIG6_0_BUSTURNAROUND))
  493. /*****************************************************************************/
  494. /*
  495. ** Macros which can be used as 'conf' parameter to GPMCCSConfig API.
  496. **
  497. */
  498. #define GPMC_CS_ENABLE (1)
  499. #define GPMC_CS_DISABLE (0)
  500. /*****************************************************************************/
  501. /*
  502. ** Macros which can be used as 'addrMask' parameter to GPMCSMaskAddrSet API.
  503. **
  504. */
  505. #define GPMC_CS_SIZE_256MB (0x00)
  506. #define GPMC_CS_SIZE_128MB (0x08)
  507. #define GPMC_CS_SIZE_64MB (0x0c)
  508. #define GPMC_CS_SIZE_32MB (0x0e)
  509. #define GPMC_CS_SIZE_16MB (0x0f)
  510. /*****************************************************************************/
  511. /*
  512. ** Macros which can be used as 'accessMode' parameter to
  513. ** GPMCPREFETCHAccessModeSelect API.
  514. */
  515. #define GPMC_PREFETCH_ACCESSMODE_READ (0)
  516. #define GPMC_PREFETCH_ACCESSMODE_WRITE (1)
  517. /*****************************************************************************/
  518. /*
  519. ** Macros which can be used as 'syncType' parameter to
  520. ** GPMCPREFETCHSyncTypeSelect API.
  521. **
  522. */
  523. #define GPMC_PREFETCH_SYNCTYPE_DMA (1)
  524. #define GPMC_PREFETCH_SYNCTYPE_INT (0)
  525. /*****************************************************************************/
  526. /*
  527. ** Macros which can be used as 'flag' parameter to GPMCPrefetchSyncModeConfig
  528. ** API.
  529. **
  530. */
  531. #define GPMC_PREFETCH_ACCESSCS_AT_START (0)
  532. #define GPMC_PREFETCH_ACCESSCS_AT_STARTANDWAIT (1)
  533. /*****************************************************************************/
  534. /*
  535. ** Macros which can be used as 'waitPin' parameter to GPMCPrefetchWaitPinSelect
  536. ** API.
  537. **
  538. */
  539. #define GPMC_PREFETCH_WAITPINSELECTOR_W0 (0)
  540. #define GPMC_PREFETCH_WAITPINSELECTOR_W1 (1)
  541. /*****************************************************************************/
  542. /*
  543. ** Macros which can be used as 'configVal' GPMCPrefetchAccessCycleOptConfig API.
  544. **
  545. */
  546. #define GPMC_PREFETCH_OPTIMIZED_ACCESS_ENABLE (1)
  547. #define GPMC_PREFETCH_OPTIMIZED_ACCESS_DISABLE (0)
  548. /*****************************************************************************/
  549. /*
  550. ** Macros which can be used as 'configVal' parameter to
  551. ** GPMCPrefetchRRArbitrationConfig API.
  552. */
  553. #define GPMC_PREFETCH_RR_ARBITRATION_ENABLE (1)
  554. #define GPMC_PREFETCH_RR_ARBITRATION_DISABLE (0)
  555. /*****************************************************************************/
  556. /*
  557. ** Macros which can be used as 'algo' parameter to GPMCECCAlgoSelect API.
  558. **
  559. */
  560. #define GPMC_ECC_ALGORITHM_HAMMINGCODE (0)
  561. #define GPMC_ECC_ALGORITHM_BCH (1)
  562. /*****************************************************************************/
  563. /*
  564. ** Macros which can be used as 'errCorrCapVal' parameter to
  565. ** GPMCECCBCHErrCorrectionCapSelect API.
  566. **
  567. */
  568. #define GPMC_ECC_BCH_ERRCORRCAP_UPTO_4BITS (0)
  569. #define GPMC_ECC_BCH_ERRCORRCAP_UPTO_8BITS (1)
  570. #define GPMC_ECC_BCH_ERRCORRCAP_UPTO_16BITS (2)
  571. /*****************************************************************************/
  572. /*
  573. ** Macros which can be used as 'eccColVal' parameter to GPMCECCColumnSelect API.
  574. **
  575. */
  576. #define GPMC_ECC_COLUMNS_8 (0)
  577. #define GPMC_ECC_COLUMNS_16 (1)
  578. /*****************************************************************************/
  579. /*
  580. ** Macros which can be used as 'numOfSects' parameter to
  581. ** GPMCECCBCHNumOfSectorsSelect API.
  582. ** Here 1 SECTOR = 512 bytes.
  583. **
  584. */
  585. #define GPMC_ECC_BCH_NUMOFSECTS_1 (0)
  586. #define GPMC_ECC_BCH_NUMOFSECTS_2 (1)
  587. #define GPMC_ECC_BCH_NUMOFSECTS_3 (2)
  588. #define GPMC_ECC_BCH_NUMOFSECTS_4 (3)
  589. #define GPMC_ECC_BCH_NUMOFSECTS_5 (4)
  590. #define GPMC_ECC_BCH_NUMOFSECTS_6 (5)
  591. #define GPMC_ECC_BCH_NUMOFSECTS_7 (6)
  592. #define GPMC_ECC_BCH_NUMOFSECTS_8 (7)
  593. /*****************************************************************************/
  594. /*
  595. ** Macros which can be used as 'eccResReg' parameter to GPMCECCResultRegSelect
  596. ** API.
  597. **
  598. */
  599. #define GPMC_ECCPOINTER_RESULT_1 (1)
  600. #define GPMC_ECCPOINTER_RESULT_2 (2)
  601. #define GPMC_ECCPOINTER_RESULT_3 (3)
  602. #define GPMC_ECCPOINTER_RESULT_4 (4)
  603. #define GPMC_ECCPOINTER_RESULT_5 (5)
  604. #define GPMC_ECCPOINTER_RESULT_6 (6)
  605. #define GPMC_ECCPOINTER_RESULT_7 (7)
  606. #define GPMC_ECCPOINTER_RESULT_8 (8)
  607. #define GPMC_ECCPOINTER_RESULT_9 (9)
  608. /*****************************************************************************/
  609. /*
  610. ** Macros which can be used as 'eccSize' parameter to GPMCECCSizeValSet API.
  611. **
  612. */
  613. #define GPMC_ECC_SIZE_0 (0)
  614. #define GPMC_ECC_SIZE_1 (1)
  615. /*****************************************************************************/
  616. /*
  617. ** Macros which can be used as 'eccResReg' parameter to GPMCECCResultSizeSelect
  618. ** API.
  619. **
  620. */
  621. #define GPMC_ECC_RESULT_1 (1)
  622. #define GPMC_ECC_RESULT_2 (2)
  623. #define GPMC_ECC_RESULT_3 (3)
  624. #define GPMC_ECC_RESULT_4 (4)
  625. #define GPMC_ECC_RESULT_5 (5)
  626. #define GPMC_ECC_RESULT_6 (6)
  627. #define GPMC_ECC_RESULT_7 (7)
  628. #define GPMC_ECC_RESULT_8 (8)
  629. #define GPMC_ECC_RESULT_9 (9)
  630. /*****************************************************************************/
  631. /*
  632. ** Macros which can be used as 'resIndex' parameter to GPMCECCBCHResultGet API.
  633. **
  634. */
  635. #define GPMC_BCH_RESULT_0 (0)
  636. #define GPMC_BCH_RESULT_1 (1)
  637. #define GPMC_BCH_RESULT_2 (2)
  638. #define GPMC_BCH_RESULT_3 (3)
  639. #define GPMC_BCH_RESULT_4 (4)
  640. #define GPMC_BCH_RESULT_5 (5)
  641. #define GPMC_BCH_RESULT_6 (6)
  642. /***************************************************************************/
  643. /*
  644. ** Function Prototypes
  645. */
  646. extern void GPMCECCEnable(unsigned int baseAddr);
  647. extern void GPMCECCDisable(unsigned int baseAddr);
  648. extern void GPMCModuleSoftReset(unsigned int baseAddr);
  649. extern void GPMCECCResultRegClear(unsigned int baseAddr);
  650. extern void GPMCPrefetchEngineStop(unsigned int baseAddr);
  651. extern void GPMCPrefetchEngineStart(unsigned int baseAddr);
  652. extern unsigned int GPMCErrAddrGet(unsigned int baseAddr);
  653. extern void GPMCPrefetchEngineEnable(unsigned int baseAddr);
  654. extern unsigned int GPMCRevisionGet(unsigned int baseAddr);
  655. extern void GPMCPrefetchEngineDisable(unsigned int baseAddr);
  656. extern unsigned int GPMCErrSysCmdGet(unsigned int baseAddr);
  657. extern unsigned int GPMCECCBCHSWDataRead(unsigned int baseAddr);
  658. extern unsigned int GPMCErrValStatusGet(unsigned int baseAddr);
  659. extern unsigned int GPMCPREFETCHCountValGet(unsigned int baseAddr);
  660. extern void GPMCIntEnable(unsigned int baseAddr, unsigned int flag);
  661. extern unsigned int GPMCModuleResetStatusGet(unsigned int baseAddr);
  662. extern unsigned int GPMCPrefetchFIFOPtrValGet(unsigned int baseAddr);
  663. extern void GPMCIntDisable(unsigned int baseAddr, unsigned int flag);
  664. extern void GPMCECCCSSelect(unsigned int baseAddr, unsigned int csNum);
  665. extern unsigned int GPMCPrefetchEngineStatusGet(unsigned int baseAddr);
  666. extern void GPMCECCAlgoSelect(unsigned int baseAddr, unsigned int algo);
  667. extern void GPMCIntStatusClear(unsigned int baseAddr, unsigned int flag);
  668. extern void GPMCIdleModeSelect(unsigned int baseAddr, unsigned int mode);
  669. extern unsigned int GPMCPrefetchFIFOThrldStatusGet(unsigned int baseAddr);
  670. extern void GPMCPrefetchCSSelect(unsigned int baseAddr, unsigned int csNum);
  671. extern void GPMCECCBCHSWDataWrite(unsigned int baseAddr,unsigned int bchData);
  672. extern unsigned int GPMCErrStatusGet(unsigned int baseAddr, unsigned int err);
  673. extern void GPMCAutoIdleConfig(unsigned int baseAddr, unsigned int configVal);
  674. extern void GPMCECCColumnSelect(unsigned int baseAddr, unsigned int eccColVal);
  675. extern unsigned int GPMCIntStatusGet(unsigned int baseAddr, unsigned int flag);
  676. extern void GPMCTimeOutFeatureConfig(unsigned int baseAddr, unsigned int flag);
  677. extern void GPMCPrefetchSyncModeConfig(unsigned int baseAddr,unsigned int flag);
  678. extern void GPMCECCResultRegSelect(unsigned int baseAddr,
  679. unsigned int eccResReg);
  680. extern unsigned int GPMCSNANDDataRead(unsigned int baseAddr,
  681. unsigned int csNum);
  682. extern unsigned int GPMCECCResultGet(unsigned int baseAddr,
  683. unsigned int eccResReg);
  684. extern void GPMCPrefetchWaitPinSelect(unsigned int baseAddr,
  685. unsigned int waitPin);
  686. extern unsigned int GPMCWaitPinStatusGet(unsigned int baseAddr,
  687. unsigned int pin);
  688. extern void GPMCPrefetchSyncTypeSelect(unsigned int baseAddr,
  689. unsigned int syncType);
  690. extern void GPMCTimeOutStartValSet(unsigned int baseAddr,
  691. unsigned int timeoutVal);
  692. extern void GPMCPrefetchCycleOptValSet(unsigned int baseAddr,
  693. unsigned int cleOptVal);
  694. extern void GPMCECCBCHWrapModeValSet(unsigned int baseAddr,
  695. unsigned int wrapModeVal);
  696. extern void GPMCPrefetchTrnsCntValSet(unsigned int baseAddr,
  697. unsigned int trnsCntVal);
  698. extern void GPMCPrefetchWeightedPrioSet(unsigned int baseAddr,
  699. unsigned int accessVal);
  700. extern void GPMCLimitedAddrDevSupportConfig(unsigned int baseAddr,
  701. unsigned int flag);
  702. extern void GPMCPrefetchAccessCycleOptConfig(unsigned int baseAddr,
  703. unsigned int configVal);
  704. extern void GPMCECCBCHNumOfSectorsSelect(unsigned int baseAddr,
  705. unsigned int numOfSects);
  706. extern void GPMCPrefetchAccessModeSelect(unsigned int baseAddr,
  707. unsigned int accessMode);
  708. extern void GPMCPrefetchFifoThrldValSet(unsigned int baseAddr,
  709. unsigned int fifoThrsld);
  710. extern void GPMCECCBCHErrCorrectionCapSelect(unsigned int baseAddr,
  711. unsigned int errCorrCapVal);
  712. extern void GPMCWriteProtectPinLevelCtrl(unsigned int baseAddr,
  713. unsigned int pinLevel);
  714. extern unsigned int GPMCEmptyWriteBuffStatusGet(unsigned int baseAddr);
  715. extern void GPMCNANDForcePostedWriteFeatureConfig(unsigned int baseAddr,
  716. unsigned int flag);
  717. extern void GPMCECCSizeValSet(unsigned int baseAddr,unsigned int eccSize,
  718. unsigned int eccSizeVal);
  719. extern void GPMCCSConfig(unsigned int baseAddr, unsigned int csNum,
  720. unsigned int conf);
  721. extern void GPMCBaseAddrSet(unsigned int baseAddr, unsigned int csNum,
  722. unsigned int addr);
  723. extern void GPMCMaskAddrSet(unsigned int baseAddr, unsigned int csNum,
  724. unsigned int maskaddr);
  725. extern void GPMNANDCmdWrite(unsigned int baseAddr, unsigned int csNum,
  726. unsigned int cmd);
  727. extern void GPMCDevTypeSelect(unsigned int baseAddr, unsigned int csNum,
  728. unsigned int devType);
  729. extern void GPMCDevSizeSelect(unsigned int baseAddr, unsigned int csNum,
  730. unsigned int devSize);
  731. extern void GPMCWaitPinSelect(unsigned int baseAddr, unsigned int csNum,
  732. unsigned int waitPin);
  733. extern void GPMCCSTimingConfig(unsigned int baseAddr, unsigned int csNum,
  734. unsigned int conf);
  735. extern void GPMCNANDAddrWrite(unsigned int baseAddr, unsigned int csNum,
  736. unsigned int addr);
  737. extern void GPMCNANDDataWrite(unsigned int baseAddr, unsigned int csNum,
  738. unsigned int data);
  739. extern void GPMCReadTypeSelect(unsigned int baseAddr, unsigned int csNum,
  740. unsigned int readType);
  741. extern void GPMCADVTimingConfig(unsigned int baseAddr, unsigned int csNum,
  742. unsigned int conf);
  743. extern void GPMCWriteTypeSelect(unsigned int baseAddr, unsigned int csNum,
  744. unsigned int writeType);
  745. extern void GPMCDevPageLenSet(unsigned int baseAddr, unsigned int csNum,
  746. unsigned int pageLen);
  747. extern void GPMCFclkDividerSelect(unsigned int baseAddr, unsigned int csNum,
  748. unsigned int divideVal);
  749. extern void GPMCWaitPinPolaritySelect(unsigned int baseAddr, unsigned int pin,
  750. unsigned int polarity);
  751. extern void GPMCECCResultSizeSelect(unsigned int baseAddr,unsigned int eccResReg,
  752. unsigned int eccSize);
  753. extern void GPMCWEAndOETimingConfig(unsigned int baseAddr, unsigned int csNum,
  754. unsigned int conf);
  755. extern void GPMCSyncWrapBurstConfig(unsigned int baseAddr, unsigned int csNum,
  756. unsigned int flag);
  757. extern unsigned int GPMCECCBCHResultGet(unsigned int baseAddr,
  758. unsigned int resIndex,
  759. unsigned int csNum);
  760. extern void GPMCClkActivationTimeConfig(unsigned int baseAddr,
  761. unsigned int csNum,
  762. unsigned int flag);
  763. extern void GPMCWaitMonitoringTimeSelect(unsigned int baseAddr,
  764. unsigned int csNum,
  765. unsigned int flag);
  766. extern void GPMCAddrDataMuxProtocolSelect(unsigned int baseAddr,
  767. unsigned int csNum,
  768. unsigned int protocol);
  769. extern void GPMCTimeParaGranularitySelect(unsigned int baseAddr,
  770. unsigned int csNum,
  771. unsigned int scaleftr);
  772. extern void GPMCRdAccessAndCycleTimeTimingConfig(unsigned int baseAddr,
  773. unsigned int csNum,
  774. unsigned int conf);
  775. extern void GPMCycle2CycleAndTurnArndTimeTimingConfig(unsigned int baseAddr,
  776. unsigned int csNum,
  777. unsigned int conf);
  778. extern void GPMCAccessTypeSelect(unsigned int baseAddr, unsigned int csNum,
  779. unsigned int mode, unsigned int accessType);
  780. extern void GPMCWaitPinMonitoringConfig(unsigned int baseAddr, unsigned int csNum,
  781. unsigned int mode, unsigned int flag);
  782. extern void GPMCWrAccessAndWrDataOnADMUXBusTimingConfig(unsigned int baseAddr,
  783. unsigned int csNum,
  784. unsigned int wrAccessTime,
  785. unsigned int wrDataOnADmuxBus);
  786. #ifdef __cplusplus
  787. }
  788. #endif
  789. #endif