chipcHw_def.h 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  1. /*****************************************************************************
  2. * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved.
  3. *
  4. * Unless you and Broadcom execute a separate written software license
  5. * agreement governing use of this software, this software is licensed to you
  6. * under the terms of the GNU General Public License version 2, available at
  7. * http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
  8. *
  9. * Notwithstanding the above, under no circumstances may you combine this
  10. * software in any way with any other Broadcom software provided under a
  11. * license other than the GPL, without Broadcom's express prior written
  12. * consent.
  13. *****************************************************************************/
  14. #ifndef CHIPC_DEF_H
  15. #define CHIPC_DEF_H
  16. /* ---- Include Files ----------------------------------------------------- */
  17. #include <csp/stdint.h>
  18. #include <csp/errno.h>
  19. #include <csp/reg.h>
  20. #include <mach/csp/chipcHw_reg.h>
  21. /* ---- Public Constants and Types ---------------------------------------- */
  22. /* Set 1 to configure DDR/VPM phase alignment by HW */
  23. #define chipcHw_DDR_HW_PHASE_ALIGN 0
  24. #define chipcHw_VPM_HW_PHASE_ALIGN 0
  25. typedef uint32_t chipcHw_freq;
  26. /* Configurable miscellaneous clocks */
  27. typedef enum {
  28. chipcHw_CLOCK_DDR, /* DDR PHY Clock */
  29. chipcHw_CLOCK_ARM, /* ARM Clock */
  30. chipcHw_CLOCK_ESW, /* Ethernet Switch Clock */
  31. chipcHw_CLOCK_VPM, /* VPM Clock */
  32. chipcHw_CLOCK_ESW125, /* Ethernet MII Clock */
  33. chipcHw_CLOCK_UART, /* UART Clock */
  34. chipcHw_CLOCK_SDIO0, /* SDIO 0 Clock */
  35. chipcHw_CLOCK_SDIO1, /* SDIO 1 Clock */
  36. chipcHw_CLOCK_SPI, /* SPI Clock */
  37. chipcHw_CLOCK_ETM, /* ARM ETM Clock */
  38. chipcHw_CLOCK_BUS, /* BUS Clock */
  39. chipcHw_CLOCK_OTP, /* OTP Clock */
  40. chipcHw_CLOCK_I2C, /* I2C Host Clock */
  41. chipcHw_CLOCK_I2S0, /* I2S 0 Host Clock */
  42. chipcHw_CLOCK_RTBUS, /* DDR PHY Configuration Clock */
  43. chipcHw_CLOCK_APM100, /* APM100 Clock */
  44. chipcHw_CLOCK_TSC, /* Touch screen Clock */
  45. chipcHw_CLOCK_LED, /* LED Clock */
  46. chipcHw_CLOCK_USB, /* USB Clock */
  47. chipcHw_CLOCK_LCD, /* LCD CLock */
  48. chipcHw_CLOCK_APM, /* APM Clock */
  49. chipcHw_CLOCK_I2S1, /* I2S 1 Host Clock */
  50. } chipcHw_CLOCK_e;
  51. /* System booting strap options */
  52. typedef enum {
  53. chipcHw_BOOT_DEVICE_UART = chipcHw_STRAPS_BOOT_DEVICE_UART,
  54. chipcHw_BOOT_DEVICE_SERIAL_FLASH =
  55. chipcHw_STRAPS_BOOT_DEVICE_SERIAL_FLASH,
  56. chipcHw_BOOT_DEVICE_NOR_FLASH_16 =
  57. chipcHw_STRAPS_BOOT_DEVICE_NOR_FLASH_16,
  58. chipcHw_BOOT_DEVICE_NAND_FLASH_8 =
  59. chipcHw_STRAPS_BOOT_DEVICE_NAND_FLASH_8,
  60. chipcHw_BOOT_DEVICE_NAND_FLASH_16 =
  61. chipcHw_STRAPS_BOOT_DEVICE_NAND_FLASH_16
  62. } chipcHw_BOOT_DEVICE_e;
  63. /* System booting modes */
  64. typedef enum {
  65. chipcHw_BOOT_MODE_NORMAL = chipcHw_STRAPS_BOOT_MODE_NORMAL,
  66. chipcHw_BOOT_MODE_DBG_SW = chipcHw_STRAPS_BOOT_MODE_DBG_SW,
  67. chipcHw_BOOT_MODE_DBG_BOOT = chipcHw_STRAPS_BOOT_MODE_DBG_BOOT,
  68. chipcHw_BOOT_MODE_NORMAL_QUIET = chipcHw_STRAPS_BOOT_MODE_NORMAL_QUIET
  69. } chipcHw_BOOT_MODE_e;
  70. /* NAND Flash page size strap options */
  71. typedef enum {
  72. chipcHw_NAND_PAGESIZE_512 = chipcHw_STRAPS_NAND_PAGESIZE_512,
  73. chipcHw_NAND_PAGESIZE_2048 = chipcHw_STRAPS_NAND_PAGESIZE_2048,
  74. chipcHw_NAND_PAGESIZE_4096 = chipcHw_STRAPS_NAND_PAGESIZE_4096,
  75. chipcHw_NAND_PAGESIZE_EXT = chipcHw_STRAPS_NAND_PAGESIZE_EXT
  76. } chipcHw_NAND_PAGESIZE_e;
  77. /* GPIO Pin function */
  78. typedef enum {
  79. chipcHw_GPIO_FUNCTION_KEYPAD = chipcHw_REG_GPIO_MUX_KEYPAD,
  80. chipcHw_GPIO_FUNCTION_I2CH = chipcHw_REG_GPIO_MUX_I2CH,
  81. chipcHw_GPIO_FUNCTION_SPI = chipcHw_REG_GPIO_MUX_SPI,
  82. chipcHw_GPIO_FUNCTION_UART = chipcHw_REG_GPIO_MUX_UART,
  83. chipcHw_GPIO_FUNCTION_LEDMTXP = chipcHw_REG_GPIO_MUX_LEDMTXP,
  84. chipcHw_GPIO_FUNCTION_LEDMTXS = chipcHw_REG_GPIO_MUX_LEDMTXS,
  85. chipcHw_GPIO_FUNCTION_SDIO0 = chipcHw_REG_GPIO_MUX_SDIO0,
  86. chipcHw_GPIO_FUNCTION_SDIO1 = chipcHw_REG_GPIO_MUX_SDIO1,
  87. chipcHw_GPIO_FUNCTION_PCM = chipcHw_REG_GPIO_MUX_PCM,
  88. chipcHw_GPIO_FUNCTION_I2S = chipcHw_REG_GPIO_MUX_I2S,
  89. chipcHw_GPIO_FUNCTION_ETM = chipcHw_REG_GPIO_MUX_ETM,
  90. chipcHw_GPIO_FUNCTION_DEBUG = chipcHw_REG_GPIO_MUX_DEBUG,
  91. chipcHw_GPIO_FUNCTION_MISC = chipcHw_REG_GPIO_MUX_MISC,
  92. chipcHw_GPIO_FUNCTION_GPIO = chipcHw_REG_GPIO_MUX_GPIO
  93. } chipcHw_GPIO_FUNCTION_e;
  94. /* PIN Output slew rate */
  95. typedef enum {
  96. chipcHw_PIN_SLEW_RATE_HIGH = chipcHw_REG_SLEW_RATE_HIGH,
  97. chipcHw_PIN_SLEW_RATE_NORMAL = chipcHw_REG_SLEW_RATE_NORMAL
  98. } chipcHw_PIN_SLEW_RATE_e;
  99. /* PIN Current drive strength */
  100. typedef enum {
  101. chipcHw_PIN_CURRENT_STRENGTH_2mA = chipcHw_REG_CURRENT_STRENGTH_2mA,
  102. chipcHw_PIN_CURRENT_STRENGTH_4mA = chipcHw_REG_CURRENT_STRENGTH_4mA,
  103. chipcHw_PIN_CURRENT_STRENGTH_6mA = chipcHw_REG_CURRENT_STRENGTH_6mA,
  104. chipcHw_PIN_CURRENT_STRENGTH_8mA = chipcHw_REG_CURRENT_STRENGTH_8mA,
  105. chipcHw_PIN_CURRENT_STRENGTH_10mA = chipcHw_REG_CURRENT_STRENGTH_10mA,
  106. chipcHw_PIN_CURRENT_STRENGTH_12mA = chipcHw_REG_CURRENT_STRENGTH_12mA
  107. } chipcHw_PIN_CURRENT_STRENGTH_e;
  108. /* PIN Pull up register settings */
  109. typedef enum {
  110. chipcHw_PIN_PULL_NONE = chipcHw_REG_PULL_NONE,
  111. chipcHw_PIN_PULL_UP = chipcHw_REG_PULL_UP,
  112. chipcHw_PIN_PULL_DOWN = chipcHw_REG_PULL_DOWN
  113. } chipcHw_PIN_PULL_e;
  114. /* PIN input type settings */
  115. typedef enum {
  116. chipcHw_PIN_INPUTTYPE_CMOS = chipcHw_REG_INPUTTYPE_CMOS,
  117. chipcHw_PIN_INPUTTYPE_ST = chipcHw_REG_INPUTTYPE_ST
  118. } chipcHw_PIN_INPUTTYPE_e;
  119. /* Allow/Disalow the support of spread spectrum */
  120. typedef enum {
  121. chipcHw_SPREAD_SPECTRUM_DISALLOW, /* Spread spectrum support is not allowed */
  122. chipcHw_SPREAD_SPECTRUM_ALLOW /* Spread spectrum support is allowed */
  123. } chipcHw_SPREAD_SPECTRUM_e;
  124. typedef struct {
  125. chipcHw_SPREAD_SPECTRUM_e ssSupport; /* Allow/Disalow to support spread spectrum.
  126. If supported, call chipcHw_enableSpreadSpectrum ()
  127. to activate the spread spectrum with desired spread. */
  128. uint32_t pllVcoFreqHz; /* PLL VCO frequency in Hz */
  129. uint32_t pll2VcoFreqHz; /* PLL2 VCO frequency in Hz */
  130. uint32_t busClockFreqHz; /* Bus clock frequency in Hz */
  131. uint32_t armBusRatio; /* ARM clock : Bus clock */
  132. uint32_t vpmBusRatio; /* VPM clock : Bus clock */
  133. uint32_t ddrBusRatio; /* DDR clock : Bus clock */
  134. } chipcHw_INIT_PARAM_t;
  135. /* CHIP revision number */
  136. typedef enum {
  137. chipcHw_REV_NUMBER_A0 = chipcHw_REG_REV_A0,
  138. chipcHw_REV_NUMBER_B0 = chipcHw_REG_REV_B0
  139. } chipcHw_REV_NUMBER_e;
  140. typedef enum {
  141. chipcHw_VPM_HW_PHASE_INTR_DISABLE = chipcHw_REG_VPM_INTR_DISABLE,
  142. chipcHw_VPM_HW_PHASE_INTR_FAST = chipcHw_REG_VPM_INTR_FAST,
  143. chipcHw_VPM_HW_PHASE_INTR_MEDIUM = chipcHw_REG_VPM_INTR_MEDIUM,
  144. chipcHw_VPM_HW_PHASE_INTR_SLOW = chipcHw_REG_VPM_INTR_SLOW
  145. } chipcHw_VPM_HW_PHASE_INTR_e;
  146. typedef enum {
  147. chipcHw_DDR_HW_PHASE_MARGIN_STRICT, /* Strict margin for DDR phase align condition */
  148. chipcHw_DDR_HW_PHASE_MARGIN_MEDIUM, /* Medium margin for DDR phase align condition */
  149. chipcHw_DDR_HW_PHASE_MARGIN_WIDE /* Wider margin for DDR phase align condition */
  150. } chipcHw_DDR_HW_PHASE_MARGIN_e;
  151. typedef enum {
  152. chipcHw_VPM_HW_PHASE_MARGIN_STRICT, /* Strict margin for VPM phase align condition */
  153. chipcHw_VPM_HW_PHASE_MARGIN_MEDIUM, /* Medium margin for VPM phase align condition */
  154. chipcHw_VPM_HW_PHASE_MARGIN_WIDE /* Wider margin for VPM phase align condition */
  155. } chipcHw_VPM_HW_PHASE_MARGIN_e;
  156. #define chipcHw_XTAL_FREQ_Hz 25000000 /* Reference clock frequency in Hz */
  157. /* Programable pin defines */
  158. #define chipcHw_PIN_GPIO(n) ((((n) >= 0) && ((n) < (chipcHw_GPIO_COUNT))) ? (n) : 0xFFFFFFFF)
  159. /* GPIO pin 0 - 60 */
  160. #define chipcHw_PIN_UARTTXD (chipcHw_GPIO_COUNT + 0) /* UART Transmit */
  161. #define chipcHw_PIN_NVI_A (chipcHw_GPIO_COUNT + 1) /* NVI Interface */
  162. #define chipcHw_PIN_NVI_D (chipcHw_GPIO_COUNT + 2) /* NVI Interface */
  163. #define chipcHw_PIN_NVI_OEB (chipcHw_GPIO_COUNT + 3) /* NVI Interface */
  164. #define chipcHw_PIN_NVI_WEB (chipcHw_GPIO_COUNT + 4) /* NVI Interface */
  165. #define chipcHw_PIN_NVI_CS (chipcHw_GPIO_COUNT + 5) /* NVI Interface */
  166. #define chipcHw_PIN_NVI_NAND_CSB (chipcHw_GPIO_COUNT + 6) /* NVI Interface */
  167. #define chipcHw_PIN_NVI_FLASHWP (chipcHw_GPIO_COUNT + 7) /* NVI Interface */
  168. #define chipcHw_PIN_NVI_NAND_RDYB (chipcHw_GPIO_COUNT + 8) /* NVI Interface */
  169. #define chipcHw_PIN_CL_DATA_0_17 (chipcHw_GPIO_COUNT + 9) /* LCD Data 0 - 17 */
  170. #define chipcHw_PIN_CL_DATA_18_20 (chipcHw_GPIO_COUNT + 10) /* LCD Data 18 - 20 */
  171. #define chipcHw_PIN_CL_DATA_21_23 (chipcHw_GPIO_COUNT + 11) /* LCD Data 21 - 23 */
  172. #define chipcHw_PIN_CL_POWER (chipcHw_GPIO_COUNT + 12) /* LCD Power */
  173. #define chipcHw_PIN_CL_ACK (chipcHw_GPIO_COUNT + 13) /* LCD Ack */
  174. #define chipcHw_PIN_CL_FP (chipcHw_GPIO_COUNT + 14) /* LCD FP */
  175. #define chipcHw_PIN_CL_LP (chipcHw_GPIO_COUNT + 15) /* LCD LP */
  176. #define chipcHw_PIN_UARTRXD (chipcHw_GPIO_COUNT + 16) /* UART Receive */
  177. /* ---- Public Variable Externs ------------------------------------------ */
  178. /* ---- Public Function Prototypes --------------------------------------- */
  179. /****************************************************************************/
  180. /**
  181. * @brief Initializes the clock module
  182. *
  183. */
  184. /****************************************************************************/
  185. void chipcHw_Init(chipcHw_INIT_PARAM_t *initParam /* [ IN ] Misc chip initialization parameter */
  186. ) __attribute__ ((section(".aramtext")));
  187. /****************************************************************************/
  188. /**
  189. * @brief Enables the PLL1
  190. *
  191. * This function enables the PLL1
  192. *
  193. */
  194. /****************************************************************************/
  195. void chipcHw_pll1Enable(uint32_t vcoFreqHz, /* [ IN ] VCO frequency in Hz */
  196. chipcHw_SPREAD_SPECTRUM_e ssSupport /* [ IN ] SS status */
  197. ) __attribute__ ((section(".aramtext")));
  198. /****************************************************************************/
  199. /**
  200. * @brief Enables the PLL2
  201. *
  202. * This function enables the PLL2
  203. *
  204. */
  205. /****************************************************************************/
  206. void chipcHw_pll2Enable(uint32_t vcoFreqHz /* [ IN ] VCO frequency in Hz */
  207. ) __attribute__ ((section(".aramtext")));
  208. /****************************************************************************/
  209. /**
  210. * @brief Disable the PLL1
  211. *
  212. */
  213. /****************************************************************************/
  214. static inline void chipcHw_pll1Disable(void);
  215. /****************************************************************************/
  216. /**
  217. * @brief Disable the PLL2
  218. *
  219. */
  220. /****************************************************************************/
  221. static inline void chipcHw_pll2Disable(void);
  222. /****************************************************************************/
  223. /**
  224. * @brief Set clock fequency for miscellaneous configurable clocks
  225. *
  226. * This function sets clock frequency
  227. *
  228. * @return Configured clock frequency in KHz
  229. *
  230. */
  231. /****************************************************************************/
  232. chipcHw_freq chipcHw_getClockFrequency(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */
  233. ) __attribute__ ((section(".aramtext")));
  234. /****************************************************************************/
  235. /**
  236. * @brief Set clock fequency for miscellaneous configurable clocks
  237. *
  238. * This function sets clock frequency
  239. *
  240. * @return Configured clock frequency in Hz
  241. *
  242. */
  243. /****************************************************************************/
  244. chipcHw_freq chipcHw_setClockFrequency(chipcHw_CLOCK_e clock, /* [ IN ] Configurable clock */
  245. uint32_t freq /* [ IN ] Clock frequency in Hz */
  246. ) __attribute__ ((section(".aramtext")));
  247. /****************************************************************************/
  248. /**
  249. * @brief Set VPM clock in sync with BUS clock
  250. *
  251. * This function does the phase adjustment between VPM and BUS clock
  252. *
  253. * @return >= 0 : On success ( # of adjustment required )
  254. * -1 : On failure
  255. */
  256. /****************************************************************************/
  257. int chipcHw_vpmPhaseAlign(void);
  258. /****************************************************************************/
  259. /**
  260. * @brief Enables core a clock of a certain device
  261. *
  262. * This function enables a core clock
  263. *
  264. * @return void
  265. *
  266. * @note Doesnot affect the bus interface clock
  267. */
  268. /****************************************************************************/
  269. static inline void chipcHw_setClockEnable(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */
  270. );
  271. /****************************************************************************/
  272. /**
  273. * @brief Disabled a core clock of a certain device
  274. *
  275. * This function disables a core clock
  276. *
  277. * @return void
  278. *
  279. * @note Doesnot affect the bus interface clock
  280. */
  281. /****************************************************************************/
  282. static inline void chipcHw_setClockDisable(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */
  283. );
  284. /****************************************************************************/
  285. /**
  286. * @brief Enables bypass clock of a certain device
  287. *
  288. * This function enables bypass clock
  289. *
  290. * @note Doesnot affect the bus interface clock
  291. */
  292. /****************************************************************************/
  293. static inline void chipcHw_bypassClockEnable(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */
  294. );
  295. /****************************************************************************/
  296. /**
  297. * @brief Disabled bypass clock of a certain device
  298. *
  299. * This function disables bypass clock
  300. *
  301. * @note Doesnot affect the bus interface clock
  302. */
  303. /****************************************************************************/
  304. static inline void chipcHw_bypassClockDisable(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */
  305. );
  306. /****************************************************************************/
  307. /**
  308. * @brief Get Numeric Chip ID
  309. *
  310. * This function returns Chip ID that includes the revison number
  311. *
  312. * @return Complete numeric Chip ID
  313. *
  314. */
  315. /****************************************************************************/
  316. static inline uint32_t chipcHw_getChipId(void);
  317. /****************************************************************************/
  318. /**
  319. * @brief Get Chip Product ID
  320. *
  321. * This function returns Chip Product ID
  322. *
  323. * @return Chip Product ID
  324. */
  325. /****************************************************************************/
  326. static inline uint32_t chipcHw_getChipProductId(void);
  327. /****************************************************************************/
  328. /**
  329. * @brief Get revision number
  330. *
  331. * This function returns revision number of the chip
  332. *
  333. * @return Revision number
  334. */
  335. /****************************************************************************/
  336. static inline chipcHw_REV_NUMBER_e chipcHw_getChipRevisionNumber(void);
  337. /****************************************************************************/
  338. /**
  339. * @brief Enables bus interface clock
  340. *
  341. * Enables bus interface clock of various device
  342. *
  343. * @return void
  344. *
  345. * @note use chipcHw_REG_BUS_CLOCK_XXXX
  346. */
  347. /****************************************************************************/
  348. static inline void chipcHw_busInterfaceClockEnable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_BUS_CLOCK_XXXXX */
  349. );
  350. /****************************************************************************/
  351. /**
  352. * @brief Disables bus interface clock
  353. *
  354. * Disables bus interface clock of various device
  355. *
  356. * @return void
  357. *
  358. * @note use chipcHw_REG_BUS_CLOCK_XXXX
  359. */
  360. /****************************************************************************/
  361. static inline void chipcHw_busInterfaceClockDisable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_BUS_CLOCK_XXXXX */
  362. );
  363. /****************************************************************************/
  364. /**
  365. * @brief Enables various audio channels
  366. *
  367. * Enables audio channel
  368. *
  369. * @return void
  370. *
  371. * @note use chipcHw_REG_AUDIO_CHANNEL_XXXXXX
  372. */
  373. /****************************************************************************/
  374. static inline void chipcHw_audioChannelEnable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_AUDIO_CHANNEL_XXXXXX */
  375. );
  376. /****************************************************************************/
  377. /**
  378. * @brief Disables various audio channels
  379. *
  380. * Disables audio channel
  381. *
  382. * @return void
  383. *
  384. * @note use chipcHw_REG_AUDIO_CHANNEL_XXXXXX
  385. */
  386. /****************************************************************************/
  387. static inline void chipcHw_audioChannelDisable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_AUDIO_CHANNEL_XXXXXX */
  388. );
  389. /****************************************************************************/
  390. /**
  391. * @brief Soft resets devices
  392. *
  393. * Soft resets various devices
  394. *
  395. * @return void
  396. *
  397. * @note use chipcHw_REG_SOFT_RESET_XXXXXX defines
  398. */
  399. /****************************************************************************/
  400. static inline void chipcHw_softReset(uint64_t mask /* [ IN ] Bit map of type chipcHw_REG_SOFT_RESET_XXXXXX */
  401. );
  402. static inline void chipcHw_softResetDisable(uint64_t mask /* [ IN ] Bit map of type chipcHw_REG_SOFT_RESET_XXXXXX */
  403. );
  404. static inline void chipcHw_softResetEnable(uint64_t mask /* [ IN ] Bit map of type chipcHw_REG_SOFT_RESET_XXXXXX */
  405. );
  406. /****************************************************************************/
  407. /**
  408. * @brief Configures misc CHIP functionality
  409. *
  410. * Configures CHIP functionality
  411. *
  412. * @return void
  413. *
  414. * @note use chipcHw_REG_MISC_CTRL_XXXXXX
  415. */
  416. /****************************************************************************/
  417. static inline void chipcHw_miscControl(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_MISC_CTRL_XXXXXX */
  418. );
  419. static inline void chipcHw_miscControlDisable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_MISC_CTRL_XXXXXX */
  420. );
  421. static inline void chipcHw_miscControlEnable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_MISC_CTRL_XXXXXX */
  422. );
  423. /****************************************************************************/
  424. /**
  425. * @brief Set OTP options
  426. *
  427. * Set OTP options
  428. *
  429. * @return void
  430. *
  431. * @note use chipcHw_REG_OTP_XXXXXX
  432. */
  433. /****************************************************************************/
  434. static inline void chipcHw_setOTPOption(uint64_t mask /* [ IN ] Bit map of type chipcHw_REG_OTP_XXXXXX */
  435. );
  436. /****************************************************************************/
  437. /**
  438. * @brief Get sticky bits
  439. *
  440. * @return Sticky bit options of type chipcHw_REG_STICKY_XXXXXX
  441. *
  442. */
  443. /****************************************************************************/
  444. static inline uint32_t chipcHw_getStickyBits(void);
  445. /****************************************************************************/
  446. /**
  447. * @brief Set sticky bits
  448. *
  449. * @return void
  450. *
  451. * @note use chipcHw_REG_STICKY_XXXXXX
  452. */
  453. /****************************************************************************/
  454. static inline void chipcHw_setStickyBits(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_STICKY_XXXXXX */
  455. );
  456. /****************************************************************************/
  457. /**
  458. * @brief Clear sticky bits
  459. *
  460. * @return void
  461. *
  462. * @note use chipcHw_REG_STICKY_XXXXXX
  463. */
  464. /****************************************************************************/
  465. static inline void chipcHw_clearStickyBits(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_STICKY_XXXXXX */
  466. );
  467. /****************************************************************************/
  468. /**
  469. * @brief Get software override strap options
  470. *
  471. * Retrieves software override strap options
  472. *
  473. * @return Software override strap value
  474. *
  475. */
  476. /****************************************************************************/
  477. static inline uint32_t chipcHw_getSoftStraps(void);
  478. /****************************************************************************/
  479. /**
  480. * @brief Set software override strap options
  481. *
  482. * set software override strap options
  483. *
  484. * @return nothing
  485. *
  486. */
  487. /****************************************************************************/
  488. static inline void chipcHw_setSoftStraps(uint32_t strapOptions);
  489. /****************************************************************************/
  490. /**
  491. * @brief Get pin strap options
  492. *
  493. * Retrieves pin strap options
  494. *
  495. * @return Pin strap value
  496. *
  497. */
  498. /****************************************************************************/
  499. static inline uint32_t chipcHw_getPinStraps(void);
  500. /****************************************************************************/
  501. /**
  502. * @brief Get valid pin strap options
  503. *
  504. * Retrieves valid pin strap options
  505. *
  506. * @return valid Pin strap value
  507. *
  508. */
  509. /****************************************************************************/
  510. static inline uint32_t chipcHw_getValidStraps(void);
  511. /****************************************************************************/
  512. /**
  513. * @brief Initialize valid pin strap options
  514. *
  515. * Retrieves valid pin strap options by copying HW strap options to soft register
  516. * (if chipcHw_STRAPS_SOFT_OVERRIDE not set)
  517. *
  518. * @return nothing
  519. *
  520. */
  521. /****************************************************************************/
  522. static inline void chipcHw_initValidStraps(void);
  523. /****************************************************************************/
  524. /**
  525. * @brief Get status (enabled/disabled) of bus interface clock
  526. *
  527. * This function returns the status of devices' bus interface clock
  528. *
  529. * @return Bus interface clock
  530. *
  531. */
  532. /****************************************************************************/
  533. static inline uint32_t chipcHw_getBusInterfaceClockStatus(void);
  534. /****************************************************************************/
  535. /**
  536. * @brief Get boot device
  537. *
  538. * This function returns the device type used in booting the system
  539. *
  540. * @return Boot device of type chipcHw_BOOT_DEVICE_e
  541. *
  542. */
  543. /****************************************************************************/
  544. static inline chipcHw_BOOT_DEVICE_e chipcHw_getBootDevice(void);
  545. /****************************************************************************/
  546. /**
  547. * @brief Get boot mode
  548. *
  549. * This function returns the way the system was booted
  550. *
  551. * @return Boot mode of type chipcHw_BOOT_MODE_e
  552. *
  553. */
  554. /****************************************************************************/
  555. static inline chipcHw_BOOT_MODE_e chipcHw_getBootMode(void);
  556. /****************************************************************************/
  557. /**
  558. * @brief Get NAND flash page size
  559. *
  560. * This function returns the NAND device page size
  561. *
  562. * @return Boot NAND device page size
  563. *
  564. */
  565. /****************************************************************************/
  566. static inline chipcHw_NAND_PAGESIZE_e chipcHw_getNandPageSize(void);
  567. /****************************************************************************/
  568. /**
  569. * @brief Get NAND flash address cycle configuration
  570. *
  571. * This function returns the NAND flash address cycle configuration
  572. *
  573. * @return 0 = Do not extra address cycle, 1 = Add extra cycle
  574. *
  575. */
  576. /****************************************************************************/
  577. static inline int chipcHw_getNandExtraCycle(void);
  578. /****************************************************************************/
  579. /**
  580. * @brief Activates PIF interface
  581. *
  582. * This function activates PIF interface by taking control of LCD pins
  583. *
  584. * @note
  585. * When activated, LCD pins will be defined as follows for PIF operation
  586. *
  587. * CLD[17:0] = pif_data[17:0]
  588. * CLD[23:18] = pif_address[5:0]
  589. * CLPOWER = pif_wr_str
  590. * CLCP = pif_rd_str
  591. * CLAC = pif_hat1
  592. * CLFP = pif_hrdy1
  593. * CLLP = pif_hat2
  594. * GPIO[42] = pif_hrdy2
  595. *
  596. * In PIF mode, "pif_hrdy2" overrides other shared function for GPIO[42] pin
  597. *
  598. */
  599. /****************************************************************************/
  600. static inline void chipcHw_activatePifInterface(void);
  601. /****************************************************************************/
  602. /**
  603. * @brief Activates LCD interface
  604. *
  605. * This function activates LCD interface
  606. *
  607. * @note
  608. * When activated, LCD pins will be defined as follows
  609. *
  610. * CLD[17:0] = LCD data
  611. * CLD[23:18] = LCD data
  612. * CLPOWER = LCD power
  613. * CLCP =
  614. * CLAC = LCD ack
  615. * CLFP =
  616. * CLLP =
  617. */
  618. /****************************************************************************/
  619. static inline void chipcHw_activateLcdInterface(void);
  620. /****************************************************************************/
  621. /**
  622. * @brief Deactivates PIF/LCD interface
  623. *
  624. * This function deactivates PIF/LCD interface
  625. *
  626. * @note
  627. * When deactivated LCD pins will be in rti-stated
  628. *
  629. */
  630. /****************************************************************************/
  631. static inline void chipcHw_deactivatePifLcdInterface(void);
  632. /****************************************************************************/
  633. /**
  634. * @brief Get to know the configuration of GPIO pin
  635. *
  636. */
  637. /****************************************************************************/
  638. static inline chipcHw_GPIO_FUNCTION_e chipcHw_getGpioPinFunction(int pin /* GPIO Pin number */
  639. );
  640. /****************************************************************************/
  641. /**
  642. * @brief Configure GPIO pin function
  643. *
  644. */
  645. /****************************************************************************/
  646. static inline void chipcHw_setGpioPinFunction(int pin, /* GPIO Pin number */
  647. chipcHw_GPIO_FUNCTION_e func /* Configuration function */
  648. );
  649. /****************************************************************************/
  650. /**
  651. * @brief Set Pin slew rate
  652. *
  653. * This function sets the slew of individual pin
  654. *
  655. */
  656. /****************************************************************************/
  657. static inline void chipcHw_setPinSlewRate(uint32_t pin, /* Pin of type chipcHw_PIN_XXXXX */
  658. chipcHw_PIN_SLEW_RATE_e slewRate /* Pin slew rate */
  659. );
  660. /****************************************************************************/
  661. /**
  662. * @brief Set Pin output drive current
  663. *
  664. * This function sets output drive current of individual pin
  665. *
  666. * Note: Avoid the use of the word 'current' since linux headers define this
  667. * to be the current task.
  668. */
  669. /****************************************************************************/
  670. static inline void chipcHw_setPinOutputCurrent(uint32_t pin, /* Pin of type chipcHw_PIN_XXXXX */
  671. chipcHw_PIN_CURRENT_STRENGTH_e curr /* Pin current rating */
  672. );
  673. /****************************************************************************/
  674. /**
  675. * @brief Set Pin pullup register
  676. *
  677. * This function sets pullup register of individual pin
  678. *
  679. */
  680. /****************************************************************************/
  681. static inline void chipcHw_setPinPullup(uint32_t pin, /* Pin of type chipcHw_PIN_XXXXX */
  682. chipcHw_PIN_PULL_e pullup /* Pullup register settings */
  683. );
  684. /****************************************************************************/
  685. /**
  686. * @brief Set Pin input type
  687. *
  688. * This function sets input type of individual Pin
  689. *
  690. */
  691. /****************************************************************************/
  692. static inline void chipcHw_setPinInputType(uint32_t pin, /* Pin of type chipcHw_PIN_XXXXX */
  693. chipcHw_PIN_INPUTTYPE_e inputType /* Pin input type */
  694. );
  695. /****************************************************************************/
  696. /**
  697. * @brief Retrieves a string representation of the mux setting for a pin.
  698. *
  699. * @return Pointer to a character string.
  700. */
  701. /****************************************************************************/
  702. const char *chipcHw_getGpioPinFunctionStr(int pin);
  703. /****************************************************************************/
  704. /** @brief issue warmReset
  705. */
  706. /****************************************************************************/
  707. void chipcHw_reset(uint32_t mask);
  708. /****************************************************************************/
  709. /** @brief clock reconfigure
  710. */
  711. /****************************************************************************/
  712. void chipcHw_clockReconfig(uint32_t busHz, uint32_t armRatio, uint32_t vpmRatio,
  713. uint32_t ddrRatio);
  714. /****************************************************************************/
  715. /**
  716. * @brief Enable Spread Spectrum
  717. *
  718. * @note chipcHw_Init() must be called earlier
  719. */
  720. /****************************************************************************/
  721. static inline void chipcHw_enableSpreadSpectrum(void);
  722. /****************************************************************************/
  723. /**
  724. * @brief Disable Spread Spectrum
  725. *
  726. */
  727. /****************************************************************************/
  728. static inline void chipcHw_disableSpreadSpectrum(void);
  729. /****************************************************************************/
  730. /** @brief Checks if software strap is enabled
  731. *
  732. * @return 1 : When enable
  733. * 0 : When disable
  734. */
  735. /****************************************************************************/
  736. static inline int chipcHw_isSoftwareStrapsEnable(void);
  737. /****************************************************************************/
  738. /** @brief Enable software strap
  739. */
  740. /****************************************************************************/
  741. static inline void chipcHw_softwareStrapsEnable(void);
  742. /****************************************************************************/
  743. /** @brief Disable software strap
  744. */
  745. /****************************************************************************/
  746. static inline void chipcHw_softwareStrapsDisable(void);
  747. /****************************************************************************/
  748. /** @brief PLL test enable
  749. */
  750. /****************************************************************************/
  751. static inline void chipcHw_pllTestEnable(void);
  752. /****************************************************************************/
  753. /** @brief PLL2 test enable
  754. */
  755. /****************************************************************************/
  756. static inline void chipcHw_pll2TestEnable(void);
  757. /****************************************************************************/
  758. /** @brief PLL test disable
  759. */
  760. /****************************************************************************/
  761. static inline void chipcHw_pllTestDisable(void);
  762. /****************************************************************************/
  763. /** @brief PLL2 test disable
  764. */
  765. /****************************************************************************/
  766. static inline void chipcHw_pll2TestDisable(void);
  767. /****************************************************************************/
  768. /** @brief Get PLL test status
  769. */
  770. /****************************************************************************/
  771. static inline int chipcHw_isPllTestEnable(void);
  772. /****************************************************************************/
  773. /** @brief Get PLL2 test status
  774. */
  775. /****************************************************************************/
  776. static inline int chipcHw_isPll2TestEnable(void);
  777. /****************************************************************************/
  778. /** @brief PLL test select
  779. */
  780. /****************************************************************************/
  781. static inline void chipcHw_pllTestSelect(uint32_t val);
  782. /****************************************************************************/
  783. /** @brief PLL2 test select
  784. */
  785. /****************************************************************************/
  786. static inline void chipcHw_pll2TestSelect(uint32_t val);
  787. /****************************************************************************/
  788. /** @brief Get PLL test selected option
  789. */
  790. /****************************************************************************/
  791. static inline uint8_t chipcHw_getPllTestSelected(void);
  792. /****************************************************************************/
  793. /** @brief Get PLL2 test selected option
  794. */
  795. /****************************************************************************/
  796. static inline uint8_t chipcHw_getPll2TestSelected(void);
  797. /****************************************************************************/
  798. /**
  799. * @brief Enables DDR SW phase alignment interrupt
  800. */
  801. /****************************************************************************/
  802. static inline void chipcHw_ddrPhaseAlignInterruptEnable(void);
  803. /****************************************************************************/
  804. /**
  805. * @brief Disables DDR SW phase alignment interrupt
  806. */
  807. /****************************************************************************/
  808. static inline void chipcHw_ddrPhaseAlignInterruptDisable(void);
  809. /****************************************************************************/
  810. /**
  811. * @brief Set VPM SW phase alignment interrupt mode
  812. *
  813. * This function sets VPM phase alignment interrupt
  814. *
  815. */
  816. /****************************************************************************/
  817. static inline void
  818. chipcHw_vpmPhaseAlignInterruptMode(chipcHw_VPM_HW_PHASE_INTR_e mode);
  819. /****************************************************************************/
  820. /**
  821. * @brief Enable DDR phase alignment in software
  822. *
  823. */
  824. /****************************************************************************/
  825. static inline void chipcHw_ddrSwPhaseAlignEnable(void);
  826. /****************************************************************************/
  827. /**
  828. * @brief Disable DDR phase alignment in software
  829. *
  830. */
  831. /****************************************************************************/
  832. static inline void chipcHw_ddrSwPhaseAlignDisable(void);
  833. /****************************************************************************/
  834. /**
  835. * @brief Enable DDR phase alignment in hardware
  836. *
  837. */
  838. /****************************************************************************/
  839. static inline void chipcHw_ddrHwPhaseAlignEnable(void);
  840. /****************************************************************************/
  841. /**
  842. * @brief Disable DDR phase alignment in hardware
  843. *
  844. */
  845. /****************************************************************************/
  846. static inline void chipcHw_ddrHwPhaseAlignDisable(void);
  847. /****************************************************************************/
  848. /**
  849. * @brief Enable VPM phase alignment in software
  850. *
  851. */
  852. /****************************************************************************/
  853. static inline void chipcHw_vpmSwPhaseAlignEnable(void);
  854. /****************************************************************************/
  855. /**
  856. * @brief Disable VPM phase alignment in software
  857. *
  858. */
  859. /****************************************************************************/
  860. static inline void chipcHw_vpmSwPhaseAlignDisable(void);
  861. /****************************************************************************/
  862. /**
  863. * @brief Enable VPM phase alignment in hardware
  864. *
  865. */
  866. /****************************************************************************/
  867. static inline void chipcHw_vpmHwPhaseAlignEnable(void);
  868. /****************************************************************************/
  869. /**
  870. * @brief Disable VPM phase alignment in hardware
  871. *
  872. */
  873. /****************************************************************************/
  874. static inline void chipcHw_vpmHwPhaseAlignDisable(void);
  875. /****************************************************************************/
  876. /**
  877. * @brief Set DDR phase alignment margin in hardware
  878. *
  879. */
  880. /****************************************************************************/
  881. static inline void chipcHw_setDdrHwPhaseAlignMargin(chipcHw_DDR_HW_PHASE_MARGIN_e margin /* Margin alinging DDR phase */
  882. );
  883. /****************************************************************************/
  884. /**
  885. * @brief Set VPM phase alignment margin in hardware
  886. *
  887. */
  888. /****************************************************************************/
  889. static inline void chipcHw_setVpmHwPhaseAlignMargin(chipcHw_VPM_HW_PHASE_MARGIN_e margin /* Margin alinging VPM phase */
  890. );
  891. /****************************************************************************/
  892. /**
  893. * @brief Checks DDR phase aligned status done by HW
  894. *
  895. * @return 1: When aligned
  896. * 0: When not aligned
  897. */
  898. /****************************************************************************/
  899. static inline uint32_t chipcHw_isDdrHwPhaseAligned(void);
  900. /****************************************************************************/
  901. /**
  902. * @brief Checks VPM phase aligned status done by HW
  903. *
  904. * @return 1: When aligned
  905. * 0: When not aligned
  906. */
  907. /****************************************************************************/
  908. static inline uint32_t chipcHw_isVpmHwPhaseAligned(void);
  909. /****************************************************************************/
  910. /**
  911. * @brief Get DDR phase aligned status done by HW
  912. *
  913. */
  914. /****************************************************************************/
  915. static inline uint32_t chipcHw_getDdrHwPhaseAlignStatus(void);
  916. /****************************************************************************/
  917. /**
  918. * @brief Get VPM phase aligned status done by HW
  919. *
  920. */
  921. /****************************************************************************/
  922. static inline uint32_t chipcHw_getVpmHwPhaseAlignStatus(void);
  923. /****************************************************************************/
  924. /**
  925. * @brief Get DDR phase control value
  926. *
  927. */
  928. /****************************************************************************/
  929. static inline uint32_t chipcHw_getDdrPhaseControl(void);
  930. /****************************************************************************/
  931. /**
  932. * @brief Get VPM phase control value
  933. *
  934. */
  935. /****************************************************************************/
  936. static inline uint32_t chipcHw_getVpmPhaseControl(void);
  937. /****************************************************************************/
  938. /**
  939. * @brief DDR phase alignment timeout count
  940. *
  941. * @note If HW fails to perform the phase alignment, it will trigger
  942. * a DDR phase alignment timeout interrupt.
  943. */
  944. /****************************************************************************/
  945. static inline void chipcHw_ddrHwPhaseAlignTimeout(uint32_t busCycle /* Timeout in bus cycle */
  946. );
  947. /****************************************************************************/
  948. /**
  949. * @brief VPM phase alignment timeout count
  950. *
  951. * @note If HW fails to perform the phase alignment, it will trigger
  952. * a VPM phase alignment timeout interrupt.
  953. */
  954. /****************************************************************************/
  955. static inline void chipcHw_vpmHwPhaseAlignTimeout(uint32_t busCycle /* Timeout in bus cycle */
  956. );
  957. /****************************************************************************/
  958. /**
  959. * @brief DDR phase alignment timeout interrupt enable
  960. *
  961. */
  962. /****************************************************************************/
  963. static inline void chipcHw_ddrHwPhaseAlignTimeoutInterruptEnable(void);
  964. /****************************************************************************/
  965. /**
  966. * @brief VPM phase alignment timeout interrupt enable
  967. *
  968. */
  969. /****************************************************************************/
  970. static inline void chipcHw_vpmHwPhaseAlignTimeoutInterruptEnable(void);
  971. /****************************************************************************/
  972. /**
  973. * @brief DDR phase alignment timeout interrupt disable
  974. *
  975. */
  976. /****************************************************************************/
  977. static inline void chipcHw_ddrHwPhaseAlignTimeoutInterruptDisable(void);
  978. /****************************************************************************/
  979. /**
  980. * @brief VPM phase alignment timeout interrupt disable
  981. *
  982. */
  983. /****************************************************************************/
  984. static inline void chipcHw_vpmHwPhaseAlignTimeoutInterruptDisable(void);
  985. /****************************************************************************/
  986. /**
  987. * @brief Clear DDR phase alignment timeout interrupt
  988. *
  989. */
  990. /****************************************************************************/
  991. static inline void chipcHw_ddrHwPhaseAlignTimeoutInterruptClear(void);
  992. /****************************************************************************/
  993. /**
  994. * @brief Clear VPM phase alignment timeout interrupt
  995. *
  996. */
  997. /****************************************************************************/
  998. static inline void chipcHw_vpmHwPhaseAlignTimeoutInterruptClear(void);
  999. /* ---- Private Constants and Types -------------------------------------- */
  1000. #endif /* CHIPC_DEF_H */