Path: blob/master/arch/arm/mach-bcmring/include/mach/csp/chipcHw_def.h
10821 views
/*****************************************************************************1* Copyright 2003 - 2008 Broadcom Corporation. All rights reserved.2*3* Unless you and Broadcom execute a separate written software license4* agreement governing use of this software, this software is licensed to you5* under the terms of the GNU General Public License version 2, available at6* http://www.broadcom.com/licenses/GPLv2.php (the "GPL").7*8* Notwithstanding the above, under no circumstances may you combine this9* software in any way with any other Broadcom software provided under a10* license other than the GPL, without Broadcom's express prior written11* consent.12*****************************************************************************/1314#ifndef CHIPC_DEF_H15#define CHIPC_DEF_H1617/* ---- Include Files ----------------------------------------------------- */1819#include <csp/stdint.h>20#include <csp/errno.h>21#include <csp/reg.h>22#include <mach/csp/chipcHw_reg.h>2324/* ---- Public Constants and Types ---------------------------------------- */2526/* Set 1 to configure DDR/VPM phase alignment by HW */27#define chipcHw_DDR_HW_PHASE_ALIGN 028#define chipcHw_VPM_HW_PHASE_ALIGN 02930typedef uint32_t chipcHw_freq;3132/* Configurable miscellaneous clocks */33typedef enum {34chipcHw_CLOCK_DDR, /* DDR PHY Clock */35chipcHw_CLOCK_ARM, /* ARM Clock */36chipcHw_CLOCK_ESW, /* Ethernet Switch Clock */37chipcHw_CLOCK_VPM, /* VPM Clock */38chipcHw_CLOCK_ESW125, /* Ethernet MII Clock */39chipcHw_CLOCK_UART, /* UART Clock */40chipcHw_CLOCK_SDIO0, /* SDIO 0 Clock */41chipcHw_CLOCK_SDIO1, /* SDIO 1 Clock */42chipcHw_CLOCK_SPI, /* SPI Clock */43chipcHw_CLOCK_ETM, /* ARM ETM Clock */4445chipcHw_CLOCK_BUS, /* BUS Clock */46chipcHw_CLOCK_OTP, /* OTP Clock */47chipcHw_CLOCK_I2C, /* I2C Host Clock */48chipcHw_CLOCK_I2S0, /* I2S 0 Host Clock */49chipcHw_CLOCK_RTBUS, /* DDR PHY Configuration Clock */50chipcHw_CLOCK_APM100, /* APM100 Clock */51chipcHw_CLOCK_TSC, /* Touch screen Clock */52chipcHw_CLOCK_LED, /* LED Clock */5354chipcHw_CLOCK_USB, /* USB Clock */55chipcHw_CLOCK_LCD, /* LCD CLock */56chipcHw_CLOCK_APM, /* APM Clock */5758chipcHw_CLOCK_I2S1, /* I2S 1 Host Clock */59} chipcHw_CLOCK_e;6061/* System booting strap options */62typedef enum {63chipcHw_BOOT_DEVICE_UART = chipcHw_STRAPS_BOOT_DEVICE_UART,64chipcHw_BOOT_DEVICE_SERIAL_FLASH =65chipcHw_STRAPS_BOOT_DEVICE_SERIAL_FLASH,66chipcHw_BOOT_DEVICE_NOR_FLASH_16 =67chipcHw_STRAPS_BOOT_DEVICE_NOR_FLASH_16,68chipcHw_BOOT_DEVICE_NAND_FLASH_8 =69chipcHw_STRAPS_BOOT_DEVICE_NAND_FLASH_8,70chipcHw_BOOT_DEVICE_NAND_FLASH_16 =71chipcHw_STRAPS_BOOT_DEVICE_NAND_FLASH_1672} chipcHw_BOOT_DEVICE_e;7374/* System booting modes */75typedef enum {76chipcHw_BOOT_MODE_NORMAL = chipcHw_STRAPS_BOOT_MODE_NORMAL,77chipcHw_BOOT_MODE_DBG_SW = chipcHw_STRAPS_BOOT_MODE_DBG_SW,78chipcHw_BOOT_MODE_DBG_BOOT = chipcHw_STRAPS_BOOT_MODE_DBG_BOOT,79chipcHw_BOOT_MODE_NORMAL_QUIET = chipcHw_STRAPS_BOOT_MODE_NORMAL_QUIET80} chipcHw_BOOT_MODE_e;8182/* NAND Flash page size strap options */83typedef enum {84chipcHw_NAND_PAGESIZE_512 = chipcHw_STRAPS_NAND_PAGESIZE_512,85chipcHw_NAND_PAGESIZE_2048 = chipcHw_STRAPS_NAND_PAGESIZE_2048,86chipcHw_NAND_PAGESIZE_4096 = chipcHw_STRAPS_NAND_PAGESIZE_4096,87chipcHw_NAND_PAGESIZE_EXT = chipcHw_STRAPS_NAND_PAGESIZE_EXT88} chipcHw_NAND_PAGESIZE_e;8990/* GPIO Pin function */91typedef enum {92chipcHw_GPIO_FUNCTION_KEYPAD = chipcHw_REG_GPIO_MUX_KEYPAD,93chipcHw_GPIO_FUNCTION_I2CH = chipcHw_REG_GPIO_MUX_I2CH,94chipcHw_GPIO_FUNCTION_SPI = chipcHw_REG_GPIO_MUX_SPI,95chipcHw_GPIO_FUNCTION_UART = chipcHw_REG_GPIO_MUX_UART,96chipcHw_GPIO_FUNCTION_LEDMTXP = chipcHw_REG_GPIO_MUX_LEDMTXP,97chipcHw_GPIO_FUNCTION_LEDMTXS = chipcHw_REG_GPIO_MUX_LEDMTXS,98chipcHw_GPIO_FUNCTION_SDIO0 = chipcHw_REG_GPIO_MUX_SDIO0,99chipcHw_GPIO_FUNCTION_SDIO1 = chipcHw_REG_GPIO_MUX_SDIO1,100chipcHw_GPIO_FUNCTION_PCM = chipcHw_REG_GPIO_MUX_PCM,101chipcHw_GPIO_FUNCTION_I2S = chipcHw_REG_GPIO_MUX_I2S,102chipcHw_GPIO_FUNCTION_ETM = chipcHw_REG_GPIO_MUX_ETM,103chipcHw_GPIO_FUNCTION_DEBUG = chipcHw_REG_GPIO_MUX_DEBUG,104chipcHw_GPIO_FUNCTION_MISC = chipcHw_REG_GPIO_MUX_MISC,105chipcHw_GPIO_FUNCTION_GPIO = chipcHw_REG_GPIO_MUX_GPIO106} chipcHw_GPIO_FUNCTION_e;107108/* PIN Output slew rate */109typedef enum {110chipcHw_PIN_SLEW_RATE_HIGH = chipcHw_REG_SLEW_RATE_HIGH,111chipcHw_PIN_SLEW_RATE_NORMAL = chipcHw_REG_SLEW_RATE_NORMAL112} chipcHw_PIN_SLEW_RATE_e;113114/* PIN Current drive strength */115typedef enum {116chipcHw_PIN_CURRENT_STRENGTH_2mA = chipcHw_REG_CURRENT_STRENGTH_2mA,117chipcHw_PIN_CURRENT_STRENGTH_4mA = chipcHw_REG_CURRENT_STRENGTH_4mA,118chipcHw_PIN_CURRENT_STRENGTH_6mA = chipcHw_REG_CURRENT_STRENGTH_6mA,119chipcHw_PIN_CURRENT_STRENGTH_8mA = chipcHw_REG_CURRENT_STRENGTH_8mA,120chipcHw_PIN_CURRENT_STRENGTH_10mA = chipcHw_REG_CURRENT_STRENGTH_10mA,121chipcHw_PIN_CURRENT_STRENGTH_12mA = chipcHw_REG_CURRENT_STRENGTH_12mA122} chipcHw_PIN_CURRENT_STRENGTH_e;123124/* PIN Pull up register settings */125typedef enum {126chipcHw_PIN_PULL_NONE = chipcHw_REG_PULL_NONE,127chipcHw_PIN_PULL_UP = chipcHw_REG_PULL_UP,128chipcHw_PIN_PULL_DOWN = chipcHw_REG_PULL_DOWN129} chipcHw_PIN_PULL_e;130131/* PIN input type settings */132typedef enum {133chipcHw_PIN_INPUTTYPE_CMOS = chipcHw_REG_INPUTTYPE_CMOS,134chipcHw_PIN_INPUTTYPE_ST = chipcHw_REG_INPUTTYPE_ST135} chipcHw_PIN_INPUTTYPE_e;136137/* Allow/Disalow the support of spread spectrum */138typedef enum {139chipcHw_SPREAD_SPECTRUM_DISALLOW, /* Spread spectrum support is not allowed */140chipcHw_SPREAD_SPECTRUM_ALLOW /* Spread spectrum support is allowed */141} chipcHw_SPREAD_SPECTRUM_e;142143typedef struct {144chipcHw_SPREAD_SPECTRUM_e ssSupport; /* Allow/Disalow to support spread spectrum.145If supported, call chipcHw_enableSpreadSpectrum ()146to activate the spread spectrum with desired spread. */147uint32_t pllVcoFreqHz; /* PLL VCO frequency in Hz */148uint32_t pll2VcoFreqHz; /* PLL2 VCO frequency in Hz */149uint32_t busClockFreqHz; /* Bus clock frequency in Hz */150uint32_t armBusRatio; /* ARM clock : Bus clock */151uint32_t vpmBusRatio; /* VPM clock : Bus clock */152uint32_t ddrBusRatio; /* DDR clock : Bus clock */153} chipcHw_INIT_PARAM_t;154155/* CHIP revision number */156typedef enum {157chipcHw_REV_NUMBER_A0 = chipcHw_REG_REV_A0,158chipcHw_REV_NUMBER_B0 = chipcHw_REG_REV_B0159} chipcHw_REV_NUMBER_e;160161typedef enum {162chipcHw_VPM_HW_PHASE_INTR_DISABLE = chipcHw_REG_VPM_INTR_DISABLE,163chipcHw_VPM_HW_PHASE_INTR_FAST = chipcHw_REG_VPM_INTR_FAST,164chipcHw_VPM_HW_PHASE_INTR_MEDIUM = chipcHw_REG_VPM_INTR_MEDIUM,165chipcHw_VPM_HW_PHASE_INTR_SLOW = chipcHw_REG_VPM_INTR_SLOW166} chipcHw_VPM_HW_PHASE_INTR_e;167168typedef enum {169chipcHw_DDR_HW_PHASE_MARGIN_STRICT, /* Strict margin for DDR phase align condition */170chipcHw_DDR_HW_PHASE_MARGIN_MEDIUM, /* Medium margin for DDR phase align condition */171chipcHw_DDR_HW_PHASE_MARGIN_WIDE /* Wider margin for DDR phase align condition */172} chipcHw_DDR_HW_PHASE_MARGIN_e;173174typedef enum {175chipcHw_VPM_HW_PHASE_MARGIN_STRICT, /* Strict margin for VPM phase align condition */176chipcHw_VPM_HW_PHASE_MARGIN_MEDIUM, /* Medium margin for VPM phase align condition */177chipcHw_VPM_HW_PHASE_MARGIN_WIDE /* Wider margin for VPM phase align condition */178} chipcHw_VPM_HW_PHASE_MARGIN_e;179180#define chipcHw_XTAL_FREQ_Hz 25000000 /* Reference clock frequency in Hz */181182/* Programmable pin defines */183#define chipcHw_PIN_GPIO(n) ((((n) >= 0) && ((n) < (chipcHw_GPIO_COUNT))) ? (n) : 0xFFFFFFFF)184/* GPIO pin 0 - 60 */185#define chipcHw_PIN_UARTTXD (chipcHw_GPIO_COUNT + 0) /* UART Transmit */186#define chipcHw_PIN_NVI_A (chipcHw_GPIO_COUNT + 1) /* NVI Interface */187#define chipcHw_PIN_NVI_D (chipcHw_GPIO_COUNT + 2) /* NVI Interface */188#define chipcHw_PIN_NVI_OEB (chipcHw_GPIO_COUNT + 3) /* NVI Interface */189#define chipcHw_PIN_NVI_WEB (chipcHw_GPIO_COUNT + 4) /* NVI Interface */190#define chipcHw_PIN_NVI_CS (chipcHw_GPIO_COUNT + 5) /* NVI Interface */191#define chipcHw_PIN_NVI_NAND_CSB (chipcHw_GPIO_COUNT + 6) /* NVI Interface */192#define chipcHw_PIN_NVI_FLASHWP (chipcHw_GPIO_COUNT + 7) /* NVI Interface */193#define chipcHw_PIN_NVI_NAND_RDYB (chipcHw_GPIO_COUNT + 8) /* NVI Interface */194#define chipcHw_PIN_CL_DATA_0_17 (chipcHw_GPIO_COUNT + 9) /* LCD Data 0 - 17 */195#define chipcHw_PIN_CL_DATA_18_20 (chipcHw_GPIO_COUNT + 10) /* LCD Data 18 - 20 */196#define chipcHw_PIN_CL_DATA_21_23 (chipcHw_GPIO_COUNT + 11) /* LCD Data 21 - 23 */197#define chipcHw_PIN_CL_POWER (chipcHw_GPIO_COUNT + 12) /* LCD Power */198#define chipcHw_PIN_CL_ACK (chipcHw_GPIO_COUNT + 13) /* LCD Ack */199#define chipcHw_PIN_CL_FP (chipcHw_GPIO_COUNT + 14) /* LCD FP */200#define chipcHw_PIN_CL_LP (chipcHw_GPIO_COUNT + 15) /* LCD LP */201#define chipcHw_PIN_UARTRXD (chipcHw_GPIO_COUNT + 16) /* UART Receive */202203/* ---- Public Variable Externs ------------------------------------------ */204/* ---- Public Function Prototypes --------------------------------------- */205206/****************************************************************************/207/**208* @brief Initializes the clock module209*210*/211/****************************************************************************/212void chipcHw_Init(chipcHw_INIT_PARAM_t *initParam /* [ IN ] Misc chip initialization parameter */213) __attribute__ ((section(".aramtext")));214215/****************************************************************************/216/**217* @brief Enables the PLL1218*219* This function enables the PLL1220*221*/222/****************************************************************************/223void chipcHw_pll1Enable(uint32_t vcoFreqHz, /* [ IN ] VCO frequency in Hz */224chipcHw_SPREAD_SPECTRUM_e ssSupport /* [ IN ] SS status */225) __attribute__ ((section(".aramtext")));226227/****************************************************************************/228/**229* @brief Enables the PLL2230*231* This function enables the PLL2232*233*/234/****************************************************************************/235void chipcHw_pll2Enable(uint32_t vcoFreqHz /* [ IN ] VCO frequency in Hz */236) __attribute__ ((section(".aramtext")));237238/****************************************************************************/239/**240* @brief Disable the PLL1241*242*/243/****************************************************************************/244static inline void chipcHw_pll1Disable(void);245246/****************************************************************************/247/**248* @brief Disable the PLL2249*250*/251/****************************************************************************/252static inline void chipcHw_pll2Disable(void);253254/****************************************************************************/255/**256* @brief Set clock fequency for miscellaneous configurable clocks257*258* This function sets clock frequency259*260* @return Configured clock frequency in KHz261*262*/263/****************************************************************************/264chipcHw_freq chipcHw_getClockFrequency(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */265) __attribute__ ((section(".aramtext")));266267/****************************************************************************/268/**269* @brief Set clock fequency for miscellaneous configurable clocks270*271* This function sets clock frequency272*273* @return Configured clock frequency in Hz274*275*/276/****************************************************************************/277chipcHw_freq chipcHw_setClockFrequency(chipcHw_CLOCK_e clock, /* [ IN ] Configurable clock */278uint32_t freq /* [ IN ] Clock frequency in Hz */279) __attribute__ ((section(".aramtext")));280281/****************************************************************************/282/**283* @brief Set VPM clock in sync with BUS clock284*285* This function does the phase adjustment between VPM and BUS clock286*287* @return >= 0 : On success ( # of adjustment required )288* -1 : On failure289*/290/****************************************************************************/291int chipcHw_vpmPhaseAlign(void);292293/****************************************************************************/294/**295* @brief Enables core a clock of a certain device296*297* This function enables a core clock298*299* @return void300*301* @note Doesnot affect the bus interface clock302*/303/****************************************************************************/304static inline void chipcHw_setClockEnable(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */305);306307/****************************************************************************/308/**309* @brief Disabled a core clock of a certain device310*311* This function disables a core clock312*313* @return void314*315* @note Doesnot affect the bus interface clock316*/317/****************************************************************************/318static inline void chipcHw_setClockDisable(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */319);320321/****************************************************************************/322/**323* @brief Enables bypass clock of a certain device324*325* This function enables bypass clock326*327* @note Doesnot affect the bus interface clock328*/329/****************************************************************************/330static inline void chipcHw_bypassClockEnable(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */331);332333/****************************************************************************/334/**335* @brief Disabled bypass clock of a certain device336*337* This function disables bypass clock338*339* @note Doesnot affect the bus interface clock340*/341/****************************************************************************/342static inline void chipcHw_bypassClockDisable(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */343);344345/****************************************************************************/346/**347* @brief Get Numeric Chip ID348*349* This function returns Chip ID that includes the revison number350*351* @return Complete numeric Chip ID352*353*/354/****************************************************************************/355static inline uint32_t chipcHw_getChipId(void);356357/****************************************************************************/358/**359* @brief Get Chip Product ID360*361* This function returns Chip Product ID362*363* @return Chip Product ID364*/365/****************************************************************************/366static inline uint32_t chipcHw_getChipProductId(void);367368/****************************************************************************/369/**370* @brief Get revision number371*372* This function returns revision number of the chip373*374* @return Revision number375*/376/****************************************************************************/377static inline chipcHw_REV_NUMBER_e chipcHw_getChipRevisionNumber(void);378379/****************************************************************************/380/**381* @brief Enables bus interface clock382*383* Enables bus interface clock of various device384*385* @return void386*387* @note use chipcHw_REG_BUS_CLOCK_XXXX388*/389/****************************************************************************/390static inline void chipcHw_busInterfaceClockEnable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_BUS_CLOCK_XXXXX */391);392393/****************************************************************************/394/**395* @brief Disables bus interface clock396*397* Disables bus interface clock of various device398*399* @return void400*401* @note use chipcHw_REG_BUS_CLOCK_XXXX402*/403/****************************************************************************/404static inline void chipcHw_busInterfaceClockDisable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_BUS_CLOCK_XXXXX */405);406407/****************************************************************************/408/**409* @brief Enables various audio channels410*411* Enables audio channel412*413* @return void414*415* @note use chipcHw_REG_AUDIO_CHANNEL_XXXXXX416*/417/****************************************************************************/418static inline void chipcHw_audioChannelEnable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_AUDIO_CHANNEL_XXXXXX */419);420421/****************************************************************************/422/**423* @brief Disables various audio channels424*425* Disables audio channel426*427* @return void428*429* @note use chipcHw_REG_AUDIO_CHANNEL_XXXXXX430*/431/****************************************************************************/432static inline void chipcHw_audioChannelDisable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_AUDIO_CHANNEL_XXXXXX */433);434435/****************************************************************************/436/**437* @brief Soft resets devices438*439* Soft resets various devices440*441* @return void442*443* @note use chipcHw_REG_SOFT_RESET_XXXXXX defines444*/445/****************************************************************************/446static inline void chipcHw_softReset(uint64_t mask /* [ IN ] Bit map of type chipcHw_REG_SOFT_RESET_XXXXXX */447);448449static inline void chipcHw_softResetDisable(uint64_t mask /* [ IN ] Bit map of type chipcHw_REG_SOFT_RESET_XXXXXX */450);451452static inline void chipcHw_softResetEnable(uint64_t mask /* [ IN ] Bit map of type chipcHw_REG_SOFT_RESET_XXXXXX */453);454455/****************************************************************************/456/**457* @brief Configures misc CHIP functionality458*459* Configures CHIP functionality460*461* @return void462*463* @note use chipcHw_REG_MISC_CTRL_XXXXXX464*/465/****************************************************************************/466static inline void chipcHw_miscControl(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_MISC_CTRL_XXXXXX */467);468469static inline void chipcHw_miscControlDisable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_MISC_CTRL_XXXXXX */470);471472static inline void chipcHw_miscControlEnable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_MISC_CTRL_XXXXXX */473);474475/****************************************************************************/476/**477* @brief Set OTP options478*479* Set OTP options480*481* @return void482*483* @note use chipcHw_REG_OTP_XXXXXX484*/485/****************************************************************************/486static inline void chipcHw_setOTPOption(uint64_t mask /* [ IN ] Bit map of type chipcHw_REG_OTP_XXXXXX */487);488489/****************************************************************************/490/**491* @brief Get sticky bits492*493* @return Sticky bit options of type chipcHw_REG_STICKY_XXXXXX494*495*/496/****************************************************************************/497static inline uint32_t chipcHw_getStickyBits(void);498499/****************************************************************************/500/**501* @brief Set sticky bits502*503* @return void504*505* @note use chipcHw_REG_STICKY_XXXXXX506*/507/****************************************************************************/508static inline void chipcHw_setStickyBits(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_STICKY_XXXXXX */509);510511/****************************************************************************/512/**513* @brief Clear sticky bits514*515* @return void516*517* @note use chipcHw_REG_STICKY_XXXXXX518*/519/****************************************************************************/520static inline void chipcHw_clearStickyBits(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_STICKY_XXXXXX */521);522523/****************************************************************************/524/**525* @brief Get software override strap options526*527* Retrieves software override strap options528*529* @return Software override strap value530*531*/532/****************************************************************************/533static inline uint32_t chipcHw_getSoftStraps(void);534535/****************************************************************************/536/**537* @brief Set software override strap options538*539* set software override strap options540*541* @return nothing542*543*/544/****************************************************************************/545static inline void chipcHw_setSoftStraps(uint32_t strapOptions);546547/****************************************************************************/548/**549* @brief Get pin strap options550*551* Retrieves pin strap options552*553* @return Pin strap value554*555*/556/****************************************************************************/557static inline uint32_t chipcHw_getPinStraps(void);558559/****************************************************************************/560/**561* @brief Get valid pin strap options562*563* Retrieves valid pin strap options564*565* @return valid Pin strap value566*567*/568/****************************************************************************/569static inline uint32_t chipcHw_getValidStraps(void);570571/****************************************************************************/572/**573* @brief Initialize valid pin strap options574*575* Retrieves valid pin strap options by copying HW strap options to soft register576* (if chipcHw_STRAPS_SOFT_OVERRIDE not set)577*578* @return nothing579*580*/581/****************************************************************************/582static inline void chipcHw_initValidStraps(void);583584/****************************************************************************/585/**586* @brief Get status (enabled/disabled) of bus interface clock587*588* This function returns the status of devices' bus interface clock589*590* @return Bus interface clock591*592*/593/****************************************************************************/594static inline uint32_t chipcHw_getBusInterfaceClockStatus(void);595596/****************************************************************************/597/**598* @brief Get boot device599*600* This function returns the device type used in booting the system601*602* @return Boot device of type chipcHw_BOOT_DEVICE_e603*604*/605/****************************************************************************/606static inline chipcHw_BOOT_DEVICE_e chipcHw_getBootDevice(void);607608/****************************************************************************/609/**610* @brief Get boot mode611*612* This function returns the way the system was booted613*614* @return Boot mode of type chipcHw_BOOT_MODE_e615*616*/617/****************************************************************************/618static inline chipcHw_BOOT_MODE_e chipcHw_getBootMode(void);619620/****************************************************************************/621/**622* @brief Get NAND flash page size623*624* This function returns the NAND device page size625*626* @return Boot NAND device page size627*628*/629/****************************************************************************/630static inline chipcHw_NAND_PAGESIZE_e chipcHw_getNandPageSize(void);631632/****************************************************************************/633/**634* @brief Get NAND flash address cycle configuration635*636* This function returns the NAND flash address cycle configuration637*638* @return 0 = Do not extra address cycle, 1 = Add extra cycle639*640*/641/****************************************************************************/642static inline int chipcHw_getNandExtraCycle(void);643644/****************************************************************************/645/**646* @brief Activates PIF interface647*648* This function activates PIF interface by taking control of LCD pins649*650* @note651* When activated, LCD pins will be defined as follows for PIF operation652*653* CLD[17:0] = pif_data[17:0]654* CLD[23:18] = pif_address[5:0]655* CLPOWER = pif_wr_str656* CLCP = pif_rd_str657* CLAC = pif_hat1658* CLFP = pif_hrdy1659* CLLP = pif_hat2660* GPIO[42] = pif_hrdy2661*662* In PIF mode, "pif_hrdy2" overrides other shared function for GPIO[42] pin663*664*/665/****************************************************************************/666static inline void chipcHw_activatePifInterface(void);667668/****************************************************************************/669/**670* @brief Activates LCD interface671*672* This function activates LCD interface673*674* @note675* When activated, LCD pins will be defined as follows676*677* CLD[17:0] = LCD data678* CLD[23:18] = LCD data679* CLPOWER = LCD power680* CLCP =681* CLAC = LCD ack682* CLFP =683* CLLP =684*/685/****************************************************************************/686static inline void chipcHw_activateLcdInterface(void);687688/****************************************************************************/689/**690* @brief Deactivates PIF/LCD interface691*692* This function deactivates PIF/LCD interface693*694* @note695* When deactivated LCD pins will be in rti-stated696*697*/698/****************************************************************************/699static inline void chipcHw_deactivatePifLcdInterface(void);700701/****************************************************************************/702/**703* @brief Get to know the configuration of GPIO pin704*705*/706/****************************************************************************/707static inline chipcHw_GPIO_FUNCTION_e chipcHw_getGpioPinFunction(int pin /* GPIO Pin number */708);709710/****************************************************************************/711/**712* @brief Configure GPIO pin function713*714*/715/****************************************************************************/716static inline void chipcHw_setGpioPinFunction(int pin, /* GPIO Pin number */717chipcHw_GPIO_FUNCTION_e func /* Configuration function */718);719720/****************************************************************************/721/**722* @brief Set Pin slew rate723*724* This function sets the slew of individual pin725*726*/727/****************************************************************************/728static inline void chipcHw_setPinSlewRate(uint32_t pin, /* Pin of type chipcHw_PIN_XXXXX */729chipcHw_PIN_SLEW_RATE_e slewRate /* Pin slew rate */730);731732/****************************************************************************/733/**734* @brief Set Pin output drive current735*736* This function sets output drive current of individual pin737*738* Note: Avoid the use of the word 'current' since linux headers define this739* to be the current task.740*/741/****************************************************************************/742static inline void chipcHw_setPinOutputCurrent(uint32_t pin, /* Pin of type chipcHw_PIN_XXXXX */743chipcHw_PIN_CURRENT_STRENGTH_e curr /* Pin current rating */744);745746/****************************************************************************/747/**748* @brief Set Pin pullup register749*750* This function sets pullup register of individual pin751*752*/753/****************************************************************************/754static inline void chipcHw_setPinPullup(uint32_t pin, /* Pin of type chipcHw_PIN_XXXXX */755chipcHw_PIN_PULL_e pullup /* Pullup register settings */756);757758/****************************************************************************/759/**760* @brief Set Pin input type761*762* This function sets input type of individual Pin763*764*/765/****************************************************************************/766static inline void chipcHw_setPinInputType(uint32_t pin, /* Pin of type chipcHw_PIN_XXXXX */767chipcHw_PIN_INPUTTYPE_e inputType /* Pin input type */768);769770/****************************************************************************/771/**772* @brief Retrieves a string representation of the mux setting for a pin.773*774* @return Pointer to a character string.775*/776/****************************************************************************/777778const char *chipcHw_getGpioPinFunctionStr(int pin);779780/****************************************************************************/781/** @brief issue warmReset782*/783/****************************************************************************/784void chipcHw_reset(uint32_t mask);785786/****************************************************************************/787/** @brief clock reconfigure788*/789/****************************************************************************/790void chipcHw_clockReconfig(uint32_t busHz, uint32_t armRatio, uint32_t vpmRatio,791uint32_t ddrRatio);792793/****************************************************************************/794/**795* @brief Enable Spread Spectrum796*797* @note chipcHw_Init() must be called earlier798*/799/****************************************************************************/800static inline void chipcHw_enableSpreadSpectrum(void);801802/****************************************************************************/803/**804* @brief Disable Spread Spectrum805*806*/807/****************************************************************************/808static inline void chipcHw_disableSpreadSpectrum(void);809810/****************************************************************************/811/** @brief Checks if software strap is enabled812*813* @return 1 : When enable814* 0 : When disable815*/816/****************************************************************************/817static inline int chipcHw_isSoftwareStrapsEnable(void);818819/****************************************************************************/820/** @brief Enable software strap821*/822/****************************************************************************/823static inline void chipcHw_softwareStrapsEnable(void);824825/****************************************************************************/826/** @brief Disable software strap827*/828/****************************************************************************/829static inline void chipcHw_softwareStrapsDisable(void);830831/****************************************************************************/832/** @brief PLL test enable833*/834/****************************************************************************/835static inline void chipcHw_pllTestEnable(void);836837/****************************************************************************/838/** @brief PLL2 test enable839*/840/****************************************************************************/841static inline void chipcHw_pll2TestEnable(void);842843/****************************************************************************/844/** @brief PLL test disable845*/846/****************************************************************************/847static inline void chipcHw_pllTestDisable(void);848849/****************************************************************************/850/** @brief PLL2 test disable851*/852/****************************************************************************/853static inline void chipcHw_pll2TestDisable(void);854855/****************************************************************************/856/** @brief Get PLL test status857*/858/****************************************************************************/859static inline int chipcHw_isPllTestEnable(void);860861/****************************************************************************/862/** @brief Get PLL2 test status863*/864/****************************************************************************/865static inline int chipcHw_isPll2TestEnable(void);866867/****************************************************************************/868/** @brief PLL test select869*/870/****************************************************************************/871static inline void chipcHw_pllTestSelect(uint32_t val);872873/****************************************************************************/874/** @brief PLL2 test select875*/876/****************************************************************************/877static inline void chipcHw_pll2TestSelect(uint32_t val);878879/****************************************************************************/880/** @brief Get PLL test selected option881*/882/****************************************************************************/883static inline uint8_t chipcHw_getPllTestSelected(void);884885/****************************************************************************/886/** @brief Get PLL2 test selected option887*/888/****************************************************************************/889static inline uint8_t chipcHw_getPll2TestSelected(void);890891/****************************************************************************/892/**893* @brief Enables DDR SW phase alignment interrupt894*/895/****************************************************************************/896static inline void chipcHw_ddrPhaseAlignInterruptEnable(void);897898/****************************************************************************/899/**900* @brief Disables DDR SW phase alignment interrupt901*/902/****************************************************************************/903static inline void chipcHw_ddrPhaseAlignInterruptDisable(void);904905/****************************************************************************/906/**907* @brief Set VPM SW phase alignment interrupt mode908*909* This function sets VPM phase alignment interrupt910*911*/912/****************************************************************************/913static inline void914chipcHw_vpmPhaseAlignInterruptMode(chipcHw_VPM_HW_PHASE_INTR_e mode);915916/****************************************************************************/917/**918* @brief Enable DDR phase alignment in software919*920*/921/****************************************************************************/922static inline void chipcHw_ddrSwPhaseAlignEnable(void);923924/****************************************************************************/925/**926* @brief Disable DDR phase alignment in software927*928*/929/****************************************************************************/930static inline void chipcHw_ddrSwPhaseAlignDisable(void);931932/****************************************************************************/933/**934* @brief Enable DDR phase alignment in hardware935*936*/937/****************************************************************************/938static inline void chipcHw_ddrHwPhaseAlignEnable(void);939940/****************************************************************************/941/**942* @brief Disable DDR phase alignment in hardware943*944*/945/****************************************************************************/946static inline void chipcHw_ddrHwPhaseAlignDisable(void);947948/****************************************************************************/949/**950* @brief Enable VPM phase alignment in software951*952*/953/****************************************************************************/954static inline void chipcHw_vpmSwPhaseAlignEnable(void);955956/****************************************************************************/957/**958* @brief Disable VPM phase alignment in software959*960*/961/****************************************************************************/962static inline void chipcHw_vpmSwPhaseAlignDisable(void);963964/****************************************************************************/965/**966* @brief Enable VPM phase alignment in hardware967*968*/969/****************************************************************************/970static inline void chipcHw_vpmHwPhaseAlignEnable(void);971972/****************************************************************************/973/**974* @brief Disable VPM phase alignment in hardware975*976*/977/****************************************************************************/978static inline void chipcHw_vpmHwPhaseAlignDisable(void);979980/****************************************************************************/981/**982* @brief Set DDR phase alignment margin in hardware983*984*/985/****************************************************************************/986static inline void chipcHw_setDdrHwPhaseAlignMargin(chipcHw_DDR_HW_PHASE_MARGIN_e margin /* Margin alinging DDR phase */987);988989/****************************************************************************/990/**991* @brief Set VPM phase alignment margin in hardware992*993*/994/****************************************************************************/995static inline void chipcHw_setVpmHwPhaseAlignMargin(chipcHw_VPM_HW_PHASE_MARGIN_e margin /* Margin alinging VPM phase */996);997998/****************************************************************************/999/**1000* @brief Checks DDR phase aligned status done by HW1001*1002* @return 1: When aligned1003* 0: When not aligned1004*/1005/****************************************************************************/1006static inline uint32_t chipcHw_isDdrHwPhaseAligned(void);10071008/****************************************************************************/1009/**1010* @brief Checks VPM phase aligned status done by HW1011*1012* @return 1: When aligned1013* 0: When not aligned1014*/1015/****************************************************************************/1016static inline uint32_t chipcHw_isVpmHwPhaseAligned(void);10171018/****************************************************************************/1019/**1020* @brief Get DDR phase aligned status done by HW1021*1022*/1023/****************************************************************************/1024static inline uint32_t chipcHw_getDdrHwPhaseAlignStatus(void);10251026/****************************************************************************/1027/**1028* @brief Get VPM phase aligned status done by HW1029*1030*/1031/****************************************************************************/1032static inline uint32_t chipcHw_getVpmHwPhaseAlignStatus(void);10331034/****************************************************************************/1035/**1036* @brief Get DDR phase control value1037*1038*/1039/****************************************************************************/1040static inline uint32_t chipcHw_getDdrPhaseControl(void);10411042/****************************************************************************/1043/**1044* @brief Get VPM phase control value1045*1046*/1047/****************************************************************************/1048static inline uint32_t chipcHw_getVpmPhaseControl(void);10491050/****************************************************************************/1051/**1052* @brief DDR phase alignment timeout count1053*1054* @note If HW fails to perform the phase alignment, it will trigger1055* a DDR phase alignment timeout interrupt.1056*/1057/****************************************************************************/1058static inline void chipcHw_ddrHwPhaseAlignTimeout(uint32_t busCycle /* Timeout in bus cycle */1059);10601061/****************************************************************************/1062/**1063* @brief VPM phase alignment timeout count1064*1065* @note If HW fails to perform the phase alignment, it will trigger1066* a VPM phase alignment timeout interrupt.1067*/1068/****************************************************************************/1069static inline void chipcHw_vpmHwPhaseAlignTimeout(uint32_t busCycle /* Timeout in bus cycle */1070);10711072/****************************************************************************/1073/**1074* @brief DDR phase alignment timeout interrupt enable1075*1076*/1077/****************************************************************************/1078static inline void chipcHw_ddrHwPhaseAlignTimeoutInterruptEnable(void);10791080/****************************************************************************/1081/**1082* @brief VPM phase alignment timeout interrupt enable1083*1084*/1085/****************************************************************************/1086static inline void chipcHw_vpmHwPhaseAlignTimeoutInterruptEnable(void);10871088/****************************************************************************/1089/**1090* @brief DDR phase alignment timeout interrupt disable1091*1092*/1093/****************************************************************************/1094static inline void chipcHw_ddrHwPhaseAlignTimeoutInterruptDisable(void);10951096/****************************************************************************/1097/**1098* @brief VPM phase alignment timeout interrupt disable1099*1100*/1101/****************************************************************************/1102static inline void chipcHw_vpmHwPhaseAlignTimeoutInterruptDisable(void);11031104/****************************************************************************/1105/**1106* @brief Clear DDR phase alignment timeout interrupt1107*1108*/1109/****************************************************************************/1110static inline void chipcHw_ddrHwPhaseAlignTimeoutInterruptClear(void);11111112/****************************************************************************/1113/**1114* @brief Clear VPM phase alignment timeout interrupt1115*1116*/1117/****************************************************************************/1118static inline void chipcHw_vpmHwPhaseAlignTimeoutInterruptClear(void);11191120/* ---- Private Constants and Types -------------------------------------- */11211122#endif /* CHIPC_DEF_H */112311241125