Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / arch / arm / mach-bcmring / include / mach / csp / chipcHw_def.h
blob161973385faf51ac2c98f80d46ab11dd9eed9d7d
1 /*****************************************************************************
2 * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved.
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").
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 *****************************************************************************/
15 #ifndef CHIPC_DEF_H
16 #define CHIPC_DEF_H
18 /* ---- Include Files ----------------------------------------------------- */
20 #include <csp/stdint.h>
21 #include <csp/errno.h>
22 #include <csp/reg.h>
23 #include <mach/csp/chipcHw_reg.h>
25 /* ---- Public Constants and Types ---------------------------------------- */
27 /* Set 1 to configure DDR/VPM phase alignment by HW */
28 #define chipcHw_DDR_HW_PHASE_ALIGN 0
29 #define chipcHw_VPM_HW_PHASE_ALIGN 0
31 typedef uint32_t chipcHw_freq;
33 /* Configurable miscellaneous clocks */
34 typedef enum {
35 chipcHw_CLOCK_DDR, /* DDR PHY Clock */
36 chipcHw_CLOCK_ARM, /* ARM Clock */
37 chipcHw_CLOCK_ESW, /* Ethernet Switch Clock */
38 chipcHw_CLOCK_VPM, /* VPM Clock */
39 chipcHw_CLOCK_ESW125, /* Ethernet MII Clock */
40 chipcHw_CLOCK_UART, /* UART Clock */
41 chipcHw_CLOCK_SDIO0, /* SDIO 0 Clock */
42 chipcHw_CLOCK_SDIO1, /* SDIO 1 Clock */
43 chipcHw_CLOCK_SPI, /* SPI Clock */
44 chipcHw_CLOCK_ETM, /* ARM ETM Clock */
46 chipcHw_CLOCK_BUS, /* BUS Clock */
47 chipcHw_CLOCK_OTP, /* OTP Clock */
48 chipcHw_CLOCK_I2C, /* I2C Host Clock */
49 chipcHw_CLOCK_I2S0, /* I2S 0 Host Clock */
50 chipcHw_CLOCK_RTBUS, /* DDR PHY Configuration Clock */
51 chipcHw_CLOCK_APM100, /* APM100 Clock */
52 chipcHw_CLOCK_TSC, /* Touch screen Clock */
53 chipcHw_CLOCK_LED, /* LED Clock */
55 chipcHw_CLOCK_USB, /* USB Clock */
56 chipcHw_CLOCK_LCD, /* LCD CLock */
57 chipcHw_CLOCK_APM, /* APM Clock */
59 chipcHw_CLOCK_I2S1, /* I2S 1 Host Clock */
60 } chipcHw_CLOCK_e;
62 /* System booting strap options */
63 typedef enum {
64 chipcHw_BOOT_DEVICE_UART = chipcHw_STRAPS_BOOT_DEVICE_UART,
65 chipcHw_BOOT_DEVICE_SERIAL_FLASH =
66 chipcHw_STRAPS_BOOT_DEVICE_SERIAL_FLASH,
67 chipcHw_BOOT_DEVICE_NOR_FLASH_16 =
68 chipcHw_STRAPS_BOOT_DEVICE_NOR_FLASH_16,
69 chipcHw_BOOT_DEVICE_NAND_FLASH_8 =
70 chipcHw_STRAPS_BOOT_DEVICE_NAND_FLASH_8,
71 chipcHw_BOOT_DEVICE_NAND_FLASH_16 =
72 chipcHw_STRAPS_BOOT_DEVICE_NAND_FLASH_16
73 } chipcHw_BOOT_DEVICE_e;
75 /* System booting modes */
76 typedef enum {
77 chipcHw_BOOT_MODE_NORMAL = chipcHw_STRAPS_BOOT_MODE_NORMAL,
78 chipcHw_BOOT_MODE_DBG_SW = chipcHw_STRAPS_BOOT_MODE_DBG_SW,
79 chipcHw_BOOT_MODE_DBG_BOOT = chipcHw_STRAPS_BOOT_MODE_DBG_BOOT,
80 chipcHw_BOOT_MODE_NORMAL_QUIET = chipcHw_STRAPS_BOOT_MODE_NORMAL_QUIET
81 } chipcHw_BOOT_MODE_e;
83 /* NAND Flash page size strap options */
84 typedef enum {
85 chipcHw_NAND_PAGESIZE_512 = chipcHw_STRAPS_NAND_PAGESIZE_512,
86 chipcHw_NAND_PAGESIZE_2048 = chipcHw_STRAPS_NAND_PAGESIZE_2048,
87 chipcHw_NAND_PAGESIZE_4096 = chipcHw_STRAPS_NAND_PAGESIZE_4096,
88 chipcHw_NAND_PAGESIZE_EXT = chipcHw_STRAPS_NAND_PAGESIZE_EXT
89 } chipcHw_NAND_PAGESIZE_e;
91 /* GPIO Pin function */
92 typedef enum {
93 chipcHw_GPIO_FUNCTION_KEYPAD = chipcHw_REG_GPIO_MUX_KEYPAD,
94 chipcHw_GPIO_FUNCTION_I2CH = chipcHw_REG_GPIO_MUX_I2CH,
95 chipcHw_GPIO_FUNCTION_SPI = chipcHw_REG_GPIO_MUX_SPI,
96 chipcHw_GPIO_FUNCTION_UART = chipcHw_REG_GPIO_MUX_UART,
97 chipcHw_GPIO_FUNCTION_LEDMTXP = chipcHw_REG_GPIO_MUX_LEDMTXP,
98 chipcHw_GPIO_FUNCTION_LEDMTXS = chipcHw_REG_GPIO_MUX_LEDMTXS,
99 chipcHw_GPIO_FUNCTION_SDIO0 = chipcHw_REG_GPIO_MUX_SDIO0,
100 chipcHw_GPIO_FUNCTION_SDIO1 = chipcHw_REG_GPIO_MUX_SDIO1,
101 chipcHw_GPIO_FUNCTION_PCM = chipcHw_REG_GPIO_MUX_PCM,
102 chipcHw_GPIO_FUNCTION_I2S = chipcHw_REG_GPIO_MUX_I2S,
103 chipcHw_GPIO_FUNCTION_ETM = chipcHw_REG_GPIO_MUX_ETM,
104 chipcHw_GPIO_FUNCTION_DEBUG = chipcHw_REG_GPIO_MUX_DEBUG,
105 chipcHw_GPIO_FUNCTION_MISC = chipcHw_REG_GPIO_MUX_MISC,
106 chipcHw_GPIO_FUNCTION_GPIO = chipcHw_REG_GPIO_MUX_GPIO
107 } chipcHw_GPIO_FUNCTION_e;
109 /* PIN Output slew rate */
110 typedef enum {
111 chipcHw_PIN_SLEW_RATE_HIGH = chipcHw_REG_SLEW_RATE_HIGH,
112 chipcHw_PIN_SLEW_RATE_NORMAL = chipcHw_REG_SLEW_RATE_NORMAL
113 } chipcHw_PIN_SLEW_RATE_e;
115 /* PIN Current drive strength */
116 typedef enum {
117 chipcHw_PIN_CURRENT_STRENGTH_2mA = chipcHw_REG_CURRENT_STRENGTH_2mA,
118 chipcHw_PIN_CURRENT_STRENGTH_4mA = chipcHw_REG_CURRENT_STRENGTH_4mA,
119 chipcHw_PIN_CURRENT_STRENGTH_6mA = chipcHw_REG_CURRENT_STRENGTH_6mA,
120 chipcHw_PIN_CURRENT_STRENGTH_8mA = chipcHw_REG_CURRENT_STRENGTH_8mA,
121 chipcHw_PIN_CURRENT_STRENGTH_10mA = chipcHw_REG_CURRENT_STRENGTH_10mA,
122 chipcHw_PIN_CURRENT_STRENGTH_12mA = chipcHw_REG_CURRENT_STRENGTH_12mA
123 } chipcHw_PIN_CURRENT_STRENGTH_e;
125 /* PIN Pull up register settings */
126 typedef enum {
127 chipcHw_PIN_PULL_NONE = chipcHw_REG_PULL_NONE,
128 chipcHw_PIN_PULL_UP = chipcHw_REG_PULL_UP,
129 chipcHw_PIN_PULL_DOWN = chipcHw_REG_PULL_DOWN
130 } chipcHw_PIN_PULL_e;
132 /* PIN input type settings */
133 typedef enum {
134 chipcHw_PIN_INPUTTYPE_CMOS = chipcHw_REG_INPUTTYPE_CMOS,
135 chipcHw_PIN_INPUTTYPE_ST = chipcHw_REG_INPUTTYPE_ST
136 } chipcHw_PIN_INPUTTYPE_e;
138 /* Allow/Disalow the support of spread spectrum */
139 typedef enum {
140 chipcHw_SPREAD_SPECTRUM_DISALLOW, /* Spread spectrum support is not allowed */
141 chipcHw_SPREAD_SPECTRUM_ALLOW /* Spread spectrum support is allowed */
142 } chipcHw_SPREAD_SPECTRUM_e;
144 typedef struct {
145 chipcHw_SPREAD_SPECTRUM_e ssSupport; /* Allow/Disalow to support spread spectrum.
146 If supported, call chipcHw_enableSpreadSpectrum ()
147 to activate the spread spectrum with desired spread. */
148 uint32_t pllVcoFreqHz; /* PLL VCO frequency in Hz */
149 uint32_t pll2VcoFreqHz; /* PLL2 VCO frequency in Hz */
150 uint32_t busClockFreqHz; /* Bus clock frequency in Hz */
151 uint32_t armBusRatio; /* ARM clock : Bus clock */
152 uint32_t vpmBusRatio; /* VPM clock : Bus clock */
153 uint32_t ddrBusRatio; /* DDR clock : Bus clock */
154 } chipcHw_INIT_PARAM_t;
156 /* CHIP revision number */
157 typedef enum {
158 chipcHw_REV_NUMBER_A0 = chipcHw_REG_REV_A0,
159 chipcHw_REV_NUMBER_B0 = chipcHw_REG_REV_B0
160 } chipcHw_REV_NUMBER_e;
162 typedef enum {
163 chipcHw_VPM_HW_PHASE_INTR_DISABLE = chipcHw_REG_VPM_INTR_DISABLE,
164 chipcHw_VPM_HW_PHASE_INTR_FAST = chipcHw_REG_VPM_INTR_FAST,
165 chipcHw_VPM_HW_PHASE_INTR_MEDIUM = chipcHw_REG_VPM_INTR_MEDIUM,
166 chipcHw_VPM_HW_PHASE_INTR_SLOW = chipcHw_REG_VPM_INTR_SLOW
167 } chipcHw_VPM_HW_PHASE_INTR_e;
169 typedef enum {
170 chipcHw_DDR_HW_PHASE_MARGIN_STRICT, /* Strict margin for DDR phase align condition */
171 chipcHw_DDR_HW_PHASE_MARGIN_MEDIUM, /* Medium margin for DDR phase align condition */
172 chipcHw_DDR_HW_PHASE_MARGIN_WIDE /* Wider margin for DDR phase align condition */
173 } chipcHw_DDR_HW_PHASE_MARGIN_e;
175 typedef enum {
176 chipcHw_VPM_HW_PHASE_MARGIN_STRICT, /* Strict margin for VPM phase align condition */
177 chipcHw_VPM_HW_PHASE_MARGIN_MEDIUM, /* Medium margin for VPM phase align condition */
178 chipcHw_VPM_HW_PHASE_MARGIN_WIDE /* Wider margin for VPM phase align condition */
179 } chipcHw_VPM_HW_PHASE_MARGIN_e;
181 #define chipcHw_XTAL_FREQ_Hz 25000000 /* Reference clock frequency in Hz */
183 /* Programmable pin defines */
184 #define chipcHw_PIN_GPIO(n) ((((n) >= 0) && ((n) < (chipcHw_GPIO_COUNT))) ? (n) : 0xFFFFFFFF)
185 /* GPIO pin 0 - 60 */
186 #define chipcHw_PIN_UARTTXD (chipcHw_GPIO_COUNT + 0) /* UART Transmit */
187 #define chipcHw_PIN_NVI_A (chipcHw_GPIO_COUNT + 1) /* NVI Interface */
188 #define chipcHw_PIN_NVI_D (chipcHw_GPIO_COUNT + 2) /* NVI Interface */
189 #define chipcHw_PIN_NVI_OEB (chipcHw_GPIO_COUNT + 3) /* NVI Interface */
190 #define chipcHw_PIN_NVI_WEB (chipcHw_GPIO_COUNT + 4) /* NVI Interface */
191 #define chipcHw_PIN_NVI_CS (chipcHw_GPIO_COUNT + 5) /* NVI Interface */
192 #define chipcHw_PIN_NVI_NAND_CSB (chipcHw_GPIO_COUNT + 6) /* NVI Interface */
193 #define chipcHw_PIN_NVI_FLASHWP (chipcHw_GPIO_COUNT + 7) /* NVI Interface */
194 #define chipcHw_PIN_NVI_NAND_RDYB (chipcHw_GPIO_COUNT + 8) /* NVI Interface */
195 #define chipcHw_PIN_CL_DATA_0_17 (chipcHw_GPIO_COUNT + 9) /* LCD Data 0 - 17 */
196 #define chipcHw_PIN_CL_DATA_18_20 (chipcHw_GPIO_COUNT + 10) /* LCD Data 18 - 20 */
197 #define chipcHw_PIN_CL_DATA_21_23 (chipcHw_GPIO_COUNT + 11) /* LCD Data 21 - 23 */
198 #define chipcHw_PIN_CL_POWER (chipcHw_GPIO_COUNT + 12) /* LCD Power */
199 #define chipcHw_PIN_CL_ACK (chipcHw_GPIO_COUNT + 13) /* LCD Ack */
200 #define chipcHw_PIN_CL_FP (chipcHw_GPIO_COUNT + 14) /* LCD FP */
201 #define chipcHw_PIN_CL_LP (chipcHw_GPIO_COUNT + 15) /* LCD LP */
202 #define chipcHw_PIN_UARTRXD (chipcHw_GPIO_COUNT + 16) /* UART Receive */
204 /* ---- Public Variable Externs ------------------------------------------ */
205 /* ---- Public Function Prototypes --------------------------------------- */
207 /****************************************************************************/
209 * @brief Initializes the clock module
212 /****************************************************************************/
213 void chipcHw_Init(chipcHw_INIT_PARAM_t *initParam /* [ IN ] Misc chip initialization parameter */
214 ) __attribute__ ((section(".aramtext")));
216 /****************************************************************************/
218 * @brief Enables the PLL1
220 * This function enables the PLL1
223 /****************************************************************************/
224 void chipcHw_pll1Enable(uint32_t vcoFreqHz, /* [ IN ] VCO frequency in Hz */
225 chipcHw_SPREAD_SPECTRUM_e ssSupport /* [ IN ] SS status */
226 ) __attribute__ ((section(".aramtext")));
228 /****************************************************************************/
230 * @brief Enables the PLL2
232 * This function enables the PLL2
235 /****************************************************************************/
236 void chipcHw_pll2Enable(uint32_t vcoFreqHz /* [ IN ] VCO frequency in Hz */
237 ) __attribute__ ((section(".aramtext")));
239 /****************************************************************************/
241 * @brief Disable the PLL1
244 /****************************************************************************/
245 static inline void chipcHw_pll1Disable(void);
247 /****************************************************************************/
249 * @brief Disable the PLL2
252 /****************************************************************************/
253 static inline void chipcHw_pll2Disable(void);
255 /****************************************************************************/
257 * @brief Set clock fequency for miscellaneous configurable clocks
259 * This function sets clock frequency
261 * @return Configured clock frequency in KHz
264 /****************************************************************************/
265 chipcHw_freq chipcHw_getClockFrequency(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */
266 ) __attribute__ ((section(".aramtext")));
268 /****************************************************************************/
270 * @brief Set clock fequency for miscellaneous configurable clocks
272 * This function sets clock frequency
274 * @return Configured clock frequency in Hz
277 /****************************************************************************/
278 chipcHw_freq chipcHw_setClockFrequency(chipcHw_CLOCK_e clock, /* [ IN ] Configurable clock */
279 uint32_t freq /* [ IN ] Clock frequency in Hz */
280 ) __attribute__ ((section(".aramtext")));
282 /****************************************************************************/
284 * @brief Set VPM clock in sync with BUS clock
286 * This function does the phase adjustment between VPM and BUS clock
288 * @return >= 0 : On success ( # of adjustment required )
289 * -1 : On failure
291 /****************************************************************************/
292 int chipcHw_vpmPhaseAlign(void);
294 /****************************************************************************/
296 * @brief Enables core a clock of a certain device
298 * This function enables a core clock
300 * @return void
302 * @note Doesnot affect the bus interface clock
304 /****************************************************************************/
305 static inline void chipcHw_setClockEnable(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */
308 /****************************************************************************/
310 * @brief Disabled a core clock of a certain device
312 * This function disables a core clock
314 * @return void
316 * @note Doesnot affect the bus interface clock
318 /****************************************************************************/
319 static inline void chipcHw_setClockDisable(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */
322 /****************************************************************************/
324 * @brief Enables bypass clock of a certain device
326 * This function enables bypass clock
328 * @note Doesnot affect the bus interface clock
330 /****************************************************************************/
331 static inline void chipcHw_bypassClockEnable(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */
334 /****************************************************************************/
336 * @brief Disabled bypass clock of a certain device
338 * This function disables bypass clock
340 * @note Doesnot affect the bus interface clock
342 /****************************************************************************/
343 static inline void chipcHw_bypassClockDisable(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */
346 /****************************************************************************/
348 * @brief Get Numeric Chip ID
350 * This function returns Chip ID that includes the revison number
352 * @return Complete numeric Chip ID
355 /****************************************************************************/
356 static inline uint32_t chipcHw_getChipId(void);
358 /****************************************************************************/
360 * @brief Get Chip Product ID
362 * This function returns Chip Product ID
364 * @return Chip Product ID
366 /****************************************************************************/
367 static inline uint32_t chipcHw_getChipProductId(void);
369 /****************************************************************************/
371 * @brief Get revision number
373 * This function returns revision number of the chip
375 * @return Revision number
377 /****************************************************************************/
378 static inline chipcHw_REV_NUMBER_e chipcHw_getChipRevisionNumber(void);
380 /****************************************************************************/
382 * @brief Enables bus interface clock
384 * Enables bus interface clock of various device
386 * @return void
388 * @note use chipcHw_REG_BUS_CLOCK_XXXX
390 /****************************************************************************/
391 static inline void chipcHw_busInterfaceClockEnable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_BUS_CLOCK_XXXXX */
394 /****************************************************************************/
396 * @brief Disables bus interface clock
398 * Disables bus interface clock of various device
400 * @return void
402 * @note use chipcHw_REG_BUS_CLOCK_XXXX
404 /****************************************************************************/
405 static inline void chipcHw_busInterfaceClockDisable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_BUS_CLOCK_XXXXX */
408 /****************************************************************************/
410 * @brief Enables various audio channels
412 * Enables audio channel
414 * @return void
416 * @note use chipcHw_REG_AUDIO_CHANNEL_XXXXXX
418 /****************************************************************************/
419 static inline void chipcHw_audioChannelEnable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_AUDIO_CHANNEL_XXXXXX */
422 /****************************************************************************/
424 * @brief Disables various audio channels
426 * Disables audio channel
428 * @return void
430 * @note use chipcHw_REG_AUDIO_CHANNEL_XXXXXX
432 /****************************************************************************/
433 static inline void chipcHw_audioChannelDisable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_AUDIO_CHANNEL_XXXXXX */
436 /****************************************************************************/
438 * @brief Soft resets devices
440 * Soft resets various devices
442 * @return void
444 * @note use chipcHw_REG_SOFT_RESET_XXXXXX defines
446 /****************************************************************************/
447 static inline void chipcHw_softReset(uint64_t mask /* [ IN ] Bit map of type chipcHw_REG_SOFT_RESET_XXXXXX */
450 static inline void chipcHw_softResetDisable(uint64_t mask /* [ IN ] Bit map of type chipcHw_REG_SOFT_RESET_XXXXXX */
453 static inline void chipcHw_softResetEnable(uint64_t mask /* [ IN ] Bit map of type chipcHw_REG_SOFT_RESET_XXXXXX */
456 /****************************************************************************/
458 * @brief Configures misc CHIP functionality
460 * Configures CHIP functionality
462 * @return void
464 * @note use chipcHw_REG_MISC_CTRL_XXXXXX
466 /****************************************************************************/
467 static inline void chipcHw_miscControl(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_MISC_CTRL_XXXXXX */
470 static inline void chipcHw_miscControlDisable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_MISC_CTRL_XXXXXX */
473 static inline void chipcHw_miscControlEnable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_MISC_CTRL_XXXXXX */
476 /****************************************************************************/
478 * @brief Set OTP options
480 * Set OTP options
482 * @return void
484 * @note use chipcHw_REG_OTP_XXXXXX
486 /****************************************************************************/
487 static inline void chipcHw_setOTPOption(uint64_t mask /* [ IN ] Bit map of type chipcHw_REG_OTP_XXXXXX */
490 /****************************************************************************/
492 * @brief Get sticky bits
494 * @return Sticky bit options of type chipcHw_REG_STICKY_XXXXXX
497 /****************************************************************************/
498 static inline uint32_t chipcHw_getStickyBits(void);
500 /****************************************************************************/
502 * @brief Set sticky bits
504 * @return void
506 * @note use chipcHw_REG_STICKY_XXXXXX
508 /****************************************************************************/
509 static inline void chipcHw_setStickyBits(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_STICKY_XXXXXX */
512 /****************************************************************************/
514 * @brief Clear sticky bits
516 * @return void
518 * @note use chipcHw_REG_STICKY_XXXXXX
520 /****************************************************************************/
521 static inline void chipcHw_clearStickyBits(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_STICKY_XXXXXX */
524 /****************************************************************************/
526 * @brief Get software override strap options
528 * Retrieves software override strap options
530 * @return Software override strap value
533 /****************************************************************************/
534 static inline uint32_t chipcHw_getSoftStraps(void);
536 /****************************************************************************/
538 * @brief Set software override strap options
540 * set software override strap options
542 * @return nothing
545 /****************************************************************************/
546 static inline void chipcHw_setSoftStraps(uint32_t strapOptions);
548 /****************************************************************************/
550 * @brief Get pin strap options
552 * Retrieves pin strap options
554 * @return Pin strap value
557 /****************************************************************************/
558 static inline uint32_t chipcHw_getPinStraps(void);
560 /****************************************************************************/
562 * @brief Get valid pin strap options
564 * Retrieves valid pin strap options
566 * @return valid Pin strap value
569 /****************************************************************************/
570 static inline uint32_t chipcHw_getValidStraps(void);
572 /****************************************************************************/
574 * @brief Initialize valid pin strap options
576 * Retrieves valid pin strap options by copying HW strap options to soft register
577 * (if chipcHw_STRAPS_SOFT_OVERRIDE not set)
579 * @return nothing
582 /****************************************************************************/
583 static inline void chipcHw_initValidStraps(void);
585 /****************************************************************************/
587 * @brief Get status (enabled/disabled) of bus interface clock
589 * This function returns the status of devices' bus interface clock
591 * @return Bus interface clock
594 /****************************************************************************/
595 static inline uint32_t chipcHw_getBusInterfaceClockStatus(void);
597 /****************************************************************************/
599 * @brief Get boot device
601 * This function returns the device type used in booting the system
603 * @return Boot device of type chipcHw_BOOT_DEVICE_e
606 /****************************************************************************/
607 static inline chipcHw_BOOT_DEVICE_e chipcHw_getBootDevice(void);
609 /****************************************************************************/
611 * @brief Get boot mode
613 * This function returns the way the system was booted
615 * @return Boot mode of type chipcHw_BOOT_MODE_e
618 /****************************************************************************/
619 static inline chipcHw_BOOT_MODE_e chipcHw_getBootMode(void);
621 /****************************************************************************/
623 * @brief Get NAND flash page size
625 * This function returns the NAND device page size
627 * @return Boot NAND device page size
630 /****************************************************************************/
631 static inline chipcHw_NAND_PAGESIZE_e chipcHw_getNandPageSize(void);
633 /****************************************************************************/
635 * @brief Get NAND flash address cycle configuration
637 * This function returns the NAND flash address cycle configuration
639 * @return 0 = Do not extra address cycle, 1 = Add extra cycle
642 /****************************************************************************/
643 static inline int chipcHw_getNandExtraCycle(void);
645 /****************************************************************************/
647 * @brief Activates PIF interface
649 * This function activates PIF interface by taking control of LCD pins
651 * @note
652 * When activated, LCD pins will be defined as follows for PIF operation
654 * CLD[17:0] = pif_data[17:0]
655 * CLD[23:18] = pif_address[5:0]
656 * CLPOWER = pif_wr_str
657 * CLCP = pif_rd_str
658 * CLAC = pif_hat1
659 * CLFP = pif_hrdy1
660 * CLLP = pif_hat2
661 * GPIO[42] = pif_hrdy2
663 * In PIF mode, "pif_hrdy2" overrides other shared function for GPIO[42] pin
666 /****************************************************************************/
667 static inline void chipcHw_activatePifInterface(void);
669 /****************************************************************************/
671 * @brief Activates LCD interface
673 * This function activates LCD interface
675 * @note
676 * When activated, LCD pins will be defined as follows
678 * CLD[17:0] = LCD data
679 * CLD[23:18] = LCD data
680 * CLPOWER = LCD power
681 * CLCP =
682 * CLAC = LCD ack
683 * CLFP =
684 * CLLP =
686 /****************************************************************************/
687 static inline void chipcHw_activateLcdInterface(void);
689 /****************************************************************************/
691 * @brief Deactivates PIF/LCD interface
693 * This function deactivates PIF/LCD interface
695 * @note
696 * When deactivated LCD pins will be in rti-stated
699 /****************************************************************************/
700 static inline void chipcHw_deactivatePifLcdInterface(void);
702 /****************************************************************************/
704 * @brief Get to know the configuration of GPIO pin
707 /****************************************************************************/
708 static inline chipcHw_GPIO_FUNCTION_e chipcHw_getGpioPinFunction(int pin /* GPIO Pin number */
711 /****************************************************************************/
713 * @brief Configure GPIO pin function
716 /****************************************************************************/
717 static inline void chipcHw_setGpioPinFunction(int pin, /* GPIO Pin number */
718 chipcHw_GPIO_FUNCTION_e func /* Configuration function */
721 /****************************************************************************/
723 * @brief Set Pin slew rate
725 * This function sets the slew of individual pin
728 /****************************************************************************/
729 static inline void chipcHw_setPinSlewRate(uint32_t pin, /* Pin of type chipcHw_PIN_XXXXX */
730 chipcHw_PIN_SLEW_RATE_e slewRate /* Pin slew rate */
733 /****************************************************************************/
735 * @brief Set Pin output drive current
737 * This function sets output drive current of individual pin
739 * Note: Avoid the use of the word 'current' since linux headers define this
740 * to be the current task.
742 /****************************************************************************/
743 static inline void chipcHw_setPinOutputCurrent(uint32_t pin, /* Pin of type chipcHw_PIN_XXXXX */
744 chipcHw_PIN_CURRENT_STRENGTH_e curr /* Pin current rating */
747 /****************************************************************************/
749 * @brief Set Pin pullup register
751 * This function sets pullup register of individual pin
754 /****************************************************************************/
755 static inline void chipcHw_setPinPullup(uint32_t pin, /* Pin of type chipcHw_PIN_XXXXX */
756 chipcHw_PIN_PULL_e pullup /* Pullup register settings */
759 /****************************************************************************/
761 * @brief Set Pin input type
763 * This function sets input type of individual Pin
766 /****************************************************************************/
767 static inline void chipcHw_setPinInputType(uint32_t pin, /* Pin of type chipcHw_PIN_XXXXX */
768 chipcHw_PIN_INPUTTYPE_e inputType /* Pin input type */
771 /****************************************************************************/
773 * @brief Retrieves a string representation of the mux setting for a pin.
775 * @return Pointer to a character string.
777 /****************************************************************************/
779 const char *chipcHw_getGpioPinFunctionStr(int pin);
781 /****************************************************************************/
782 /** @brief issue warmReset
784 /****************************************************************************/
785 void chipcHw_reset(uint32_t mask);
787 /****************************************************************************/
788 /** @brief clock reconfigure
790 /****************************************************************************/
791 void chipcHw_clockReconfig(uint32_t busHz, uint32_t armRatio, uint32_t vpmRatio,
792 uint32_t ddrRatio);
794 /****************************************************************************/
796 * @brief Enable Spread Spectrum
798 * @note chipcHw_Init() must be called earlier
800 /****************************************************************************/
801 static inline void chipcHw_enableSpreadSpectrum(void);
803 /****************************************************************************/
805 * @brief Disable Spread Spectrum
808 /****************************************************************************/
809 static inline void chipcHw_disableSpreadSpectrum(void);
811 /****************************************************************************/
812 /** @brief Checks if software strap is enabled
814 * @return 1 : When enable
815 * 0 : When disable
817 /****************************************************************************/
818 static inline int chipcHw_isSoftwareStrapsEnable(void);
820 /****************************************************************************/
821 /** @brief Enable software strap
823 /****************************************************************************/
824 static inline void chipcHw_softwareStrapsEnable(void);
826 /****************************************************************************/
827 /** @brief Disable software strap
829 /****************************************************************************/
830 static inline void chipcHw_softwareStrapsDisable(void);
832 /****************************************************************************/
833 /** @brief PLL test enable
835 /****************************************************************************/
836 static inline void chipcHw_pllTestEnable(void);
838 /****************************************************************************/
839 /** @brief PLL2 test enable
841 /****************************************************************************/
842 static inline void chipcHw_pll2TestEnable(void);
844 /****************************************************************************/
845 /** @brief PLL test disable
847 /****************************************************************************/
848 static inline void chipcHw_pllTestDisable(void);
850 /****************************************************************************/
851 /** @brief PLL2 test disable
853 /****************************************************************************/
854 static inline void chipcHw_pll2TestDisable(void);
856 /****************************************************************************/
857 /** @brief Get PLL test status
859 /****************************************************************************/
860 static inline int chipcHw_isPllTestEnable(void);
862 /****************************************************************************/
863 /** @brief Get PLL2 test status
865 /****************************************************************************/
866 static inline int chipcHw_isPll2TestEnable(void);
868 /****************************************************************************/
869 /** @brief PLL test select
871 /****************************************************************************/
872 static inline void chipcHw_pllTestSelect(uint32_t val);
874 /****************************************************************************/
875 /** @brief PLL2 test select
877 /****************************************************************************/
878 static inline void chipcHw_pll2TestSelect(uint32_t val);
880 /****************************************************************************/
881 /** @brief Get PLL test selected option
883 /****************************************************************************/
884 static inline uint8_t chipcHw_getPllTestSelected(void);
886 /****************************************************************************/
887 /** @brief Get PLL2 test selected option
889 /****************************************************************************/
890 static inline uint8_t chipcHw_getPll2TestSelected(void);
892 /****************************************************************************/
894 * @brief Enables DDR SW phase alignment interrupt
896 /****************************************************************************/
897 static inline void chipcHw_ddrPhaseAlignInterruptEnable(void);
899 /****************************************************************************/
901 * @brief Disables DDR SW phase alignment interrupt
903 /****************************************************************************/
904 static inline void chipcHw_ddrPhaseAlignInterruptDisable(void);
906 /****************************************************************************/
908 * @brief Set VPM SW phase alignment interrupt mode
910 * This function sets VPM phase alignment interrupt
913 /****************************************************************************/
914 static inline void
915 chipcHw_vpmPhaseAlignInterruptMode(chipcHw_VPM_HW_PHASE_INTR_e mode);
917 /****************************************************************************/
919 * @brief Enable DDR phase alignment in software
922 /****************************************************************************/
923 static inline void chipcHw_ddrSwPhaseAlignEnable(void);
925 /****************************************************************************/
927 * @brief Disable DDR phase alignment in software
930 /****************************************************************************/
931 static inline void chipcHw_ddrSwPhaseAlignDisable(void);
933 /****************************************************************************/
935 * @brief Enable DDR phase alignment in hardware
938 /****************************************************************************/
939 static inline void chipcHw_ddrHwPhaseAlignEnable(void);
941 /****************************************************************************/
943 * @brief Disable DDR phase alignment in hardware
946 /****************************************************************************/
947 static inline void chipcHw_ddrHwPhaseAlignDisable(void);
949 /****************************************************************************/
951 * @brief Enable VPM phase alignment in software
954 /****************************************************************************/
955 static inline void chipcHw_vpmSwPhaseAlignEnable(void);
957 /****************************************************************************/
959 * @brief Disable VPM phase alignment in software
962 /****************************************************************************/
963 static inline void chipcHw_vpmSwPhaseAlignDisable(void);
965 /****************************************************************************/
967 * @brief Enable VPM phase alignment in hardware
970 /****************************************************************************/
971 static inline void chipcHw_vpmHwPhaseAlignEnable(void);
973 /****************************************************************************/
975 * @brief Disable VPM phase alignment in hardware
978 /****************************************************************************/
979 static inline void chipcHw_vpmHwPhaseAlignDisable(void);
981 /****************************************************************************/
983 * @brief Set DDR phase alignment margin in hardware
986 /****************************************************************************/
987 static inline void chipcHw_setDdrHwPhaseAlignMargin(chipcHw_DDR_HW_PHASE_MARGIN_e margin /* Margin alinging DDR phase */
990 /****************************************************************************/
992 * @brief Set VPM phase alignment margin in hardware
995 /****************************************************************************/
996 static inline void chipcHw_setVpmHwPhaseAlignMargin(chipcHw_VPM_HW_PHASE_MARGIN_e margin /* Margin alinging VPM phase */
999 /****************************************************************************/
1001 * @brief Checks DDR phase aligned status done by HW
1003 * @return 1: When aligned
1004 * 0: When not aligned
1006 /****************************************************************************/
1007 static inline uint32_t chipcHw_isDdrHwPhaseAligned(void);
1009 /****************************************************************************/
1011 * @brief Checks VPM phase aligned status done by HW
1013 * @return 1: When aligned
1014 * 0: When not aligned
1016 /****************************************************************************/
1017 static inline uint32_t chipcHw_isVpmHwPhaseAligned(void);
1019 /****************************************************************************/
1021 * @brief Get DDR phase aligned status done by HW
1024 /****************************************************************************/
1025 static inline uint32_t chipcHw_getDdrHwPhaseAlignStatus(void);
1027 /****************************************************************************/
1029 * @brief Get VPM phase aligned status done by HW
1032 /****************************************************************************/
1033 static inline uint32_t chipcHw_getVpmHwPhaseAlignStatus(void);
1035 /****************************************************************************/
1037 * @brief Get DDR phase control value
1040 /****************************************************************************/
1041 static inline uint32_t chipcHw_getDdrPhaseControl(void);
1043 /****************************************************************************/
1045 * @brief Get VPM phase control value
1048 /****************************************************************************/
1049 static inline uint32_t chipcHw_getVpmPhaseControl(void);
1051 /****************************************************************************/
1053 * @brief DDR phase alignment timeout count
1055 * @note If HW fails to perform the phase alignment, it will trigger
1056 * a DDR phase alignment timeout interrupt.
1058 /****************************************************************************/
1059 static inline void chipcHw_ddrHwPhaseAlignTimeout(uint32_t busCycle /* Timeout in bus cycle */
1062 /****************************************************************************/
1064 * @brief VPM phase alignment timeout count
1066 * @note If HW fails to perform the phase alignment, it will trigger
1067 * a VPM phase alignment timeout interrupt.
1069 /****************************************************************************/
1070 static inline void chipcHw_vpmHwPhaseAlignTimeout(uint32_t busCycle /* Timeout in bus cycle */
1073 /****************************************************************************/
1075 * @brief DDR phase alignment timeout interrupt enable
1078 /****************************************************************************/
1079 static inline void chipcHw_ddrHwPhaseAlignTimeoutInterruptEnable(void);
1081 /****************************************************************************/
1083 * @brief VPM phase alignment timeout interrupt enable
1086 /****************************************************************************/
1087 static inline void chipcHw_vpmHwPhaseAlignTimeoutInterruptEnable(void);
1089 /****************************************************************************/
1091 * @brief DDR phase alignment timeout interrupt disable
1094 /****************************************************************************/
1095 static inline void chipcHw_ddrHwPhaseAlignTimeoutInterruptDisable(void);
1097 /****************************************************************************/
1099 * @brief VPM phase alignment timeout interrupt disable
1102 /****************************************************************************/
1103 static inline void chipcHw_vpmHwPhaseAlignTimeoutInterruptDisable(void);
1105 /****************************************************************************/
1107 * @brief Clear DDR phase alignment timeout interrupt
1110 /****************************************************************************/
1111 static inline void chipcHw_ddrHwPhaseAlignTimeoutInterruptClear(void);
1113 /****************************************************************************/
1115 * @brief Clear VPM phase alignment timeout interrupt
1118 /****************************************************************************/
1119 static inline void chipcHw_vpmHwPhaseAlignTimeoutInterruptClear(void);
1121 /* ---- Private Constants and Types -------------------------------------- */
1123 #endif /* CHIPC_DEF_H */