#ifndef _BHND_CORES_CHIPC_CHIPCREG_H_
#define _BHND_CORES_CHIPC_CHIPCREG_H_
#define CHIPC_HWREV_HAS_CORECTRL(hwrev) ((hwrev) >= 1)
#define CHIPC_NCORES_MIN_HWREV(hwrev) ((hwrev) == 4 || (hwrev) >= 6)
#define CHIPC_HWREV_HAS_CAP_EXT(hwrev) ((hwrev) >= 35)
#define CHIPC_HAS_EROMPTR(_chipid) \
(CHIPC_GET_BITS((_chipid), CHIPC_ID_BUS) != BHND_CHIPTYPE_SIBA)
#define CHIPC_GET_FLAG(_value, _flag) (((_value) & _flag) != 0)
#define CHIPC_GET_BITS(_value, _field) \
((_value & _field ## _MASK) >> _field ## _SHIFT)
#define CHIPC_ID 0x00
#define CHIPC_CAPABILITIES 0x04
#define CHIPC_CORECTRL 0x08
#define CHIPC_BIST 0x0C
#define CHIPC_OTPST 0x10
#define CHIPC_OTPCTRL 0x14
#define CHIPC_OTPPROG 0x18
#define CHIPC_OTPLAYOUT 0x1C
#define CHIPC_INTST 0x20
#define CHIPC_INTM 0x24
#define CHIPC_CHIPCTRL 0x28
#define CHIPC_CHIPST 0x2C
#define CHIPC_JTAGCMD 0x30
#define CHIPC_JTAGIR 0x34
#define CHIPC_JTAGDR 0x38
#define CHIPC_JTAGCTRL 0x3c
#define CHIPC_SFLASH_BASE 0x40
#define CHIPC_SFLASH_SIZE 12
#define CHIPC_SFLASHCTRL 0x40
#define CHIPC_SFLASHADDR 0x44
#define CHIPC_SFLASHDATA 0x48
#define CHIPC_SBBCAST_ADDR 0x50
#define CHIPC_SBBCAST_DATA 0x54
#define CHIPC_GPIOPU 0x58
#define CHIPC_GPIOPD 0x5C
#define CHIPC_GPIOIN 0x60
#define CHIPC_GPIOOUT 0x64
#define CHIPC_GPIOOUTEN 0x68
#define CHIPC_GPIOCTRL 0x6C
#define CHIPC_GPIOPOL 0x70
#define CHIPC_GPIOINTM 0x74
#define CHIPC_GPIOEVENT 0x78
#define CHIPC_GPIOEVENT_INTM 0x7C
#define CHIPC_WATCHDOG 0x80
#define CHIPC_GPIOEVENT_INTPOLARITY 0x84
#define CHIPC_GPIOTIMERVAL 0x88
#define CHIPC_GPIOTIMEROUTMASK 0x8C
#define CHIPC_CLKC_N 0x90
#define CHIPC_CLKC_SB 0x94
#define CHIPC_CLKC_PCI 0x98
#define CHIPC_CLKC_M2 0x9C
#define CHIPC_CLKC_M3 0xA0
#define CHIPC_CLKDIV 0xA4
#define CHIPC_GPIODEBUGSEL 0xA8
#define CHIPC_CAPABILITIES_EXT 0xAC
#define CHIPC_PLL_ON_DELAY 0xB0
#define CHIPC_PLL_FREFSEL_DELAY 0xB4
#define CHIPC_PLL_SLOWCLK_CTL 0xB8
#define CHIPC_SYS_CLK_CTL 0xC0
#define CHIPC_SYS_CLK_ST_STRETCH 0xC4
#define CHIPC_BP_ADDRLOW 0xD0
#define CHIPC_BP_ADDRHIGH 0xD4
#define CHIPC_BP_DATA 0xD8
#define CHIPC_BP_INDACCESS 0xE0
#define CHIPC_GSIO_CTRL 0xE4
#define CHIPC_GSIO_ADDR 0xE8
#define CHIPC_GSIO_DATA 0xEC
#define CHIPC_CLKDIV2 0xF0
#define CHIPC_EROMPTR 0xFC
#define CHIPC_PCMCIA_CFG 0x100
#define CHIPC_PCMCIA_MEMWAIT 0x104
#define CHIPC_PCMCIA_ATTRWAIT 0x108
#define CHIPC_PCMCIA_IOWAIT 0x10C
#define CHIPC_IDE_CFG 0x110
#define CHIPC_IDE_MEMWAIT 0x114
#define CHIPC_IDE_ATTRWAIT 0x118
#define CHIPC_IDE_IOWAIT 0x11C
#define CHIPC_PROG_CFG 0x120
#define CHIPC_PROG_WAITCOUNT 0x124
#define CHIPC_FLASH_CFG 0x128
#define CHIPC_FLASH_WAITCOUNT 0x12C
#define CHIPC_SECI_CFG 0x130
#define CHIPC_SECI_ST 0x134
#define CHIPC_SECI_STM 0x138
#define CHIPC_SECI_RXNBC 0x13C
#define CHIPC_ECI_OUTPUT 0x140
#define CHIPC_ECI_CTRL 0x144
#define CHIPC_ECI_INPUTLO 0x148
#define CHIPC_ECI_INPUTMI 0x14C
#define CHIPC_ECI_INPUTHI 0x150
#define CHIPC_ECI_INPUTINTPOLARITYLO 0x154
#define CHIPC_ECI_INPUTINTPOLARITYMI 0x158
#define CHIPC_ECI_INPUTINTPOLARITYHI 0x15C
#define CHIPC_ECI_INTMASKLO 0x160
#define CHIPC_ECI_INTMASKMI 0x164
#define CHIPC_ECI_INTMASKHI 0x168
#define CHIPC_ECI_EVENTLO 0x16C
#define CHIPC_ECI_EVENTMI 0x170
#define CHIPC_ECI_EVENTHI 0x174
#define CHIPC_ECI_EVENTMASKLO 0x178
#define CHIPC_ECI_EVENTMASKMI 0x17C
#define CHIPC_ECI_EVENTMASKHI 0x180
#define CHIPC_FLASHSTRCFG 0x18C
#define CHIPC_SPROM_CTRL 0x190
#define CHIPC_SPROM_ADDR 0x194
#define CHIPC_SPROM_DATA 0x198
#define CHIPC_CLK_CTL_ST 0x1E0
#define CHIPC_SPROM_HWWAR 0x19
#define CHIPC_UART_BASE 0x300
#define CHIPC_UART_SIZE 0x100
#define CHIPC_UART_MAX 3
#define CHIPC_UART(_n) (CHIPC_UART_BASE + (CHIPC_UART_SIZE*_n))
#define CHIPC_PMU_BASE 0x600
#define CHIPC_PMU_SIZE 0x70
#define CHIPC_SPROM_OTP 0x800
#define CHIPC_SPROM_OTP_SIZE 0x400
#define CHIPC_ID_CHIP_MASK 0x0000FFFF
#define CHIPC_ID_CHIP_SHIFT 0
#define CHIPC_ID_REV_MASK 0x000F0000
#define CHIPC_ID_REV_SHIFT 16
#define CHIPC_ID_PKG_MASK 0x00F00000
#define CHIPC_ID_PKG_SHIFT 20
#define CHIPC_ID_NUMCORE_MASK 0x0F000000
#define CHIPC_ID_NUMCORE_SHIFT 24
#define CHIPC_ID_BUS_MASK 0xF0000000
#define CHIPC_ID_BUS_SHIFT 28
#define CHIPC_CAP_NUM_UART_MASK 0x00000003
#define CHIPC_CAP_NUM_UART_SHIFT 0
#define CHIPC_CAP_MIPSEB 0x00000004
#define CHIPC_CAP_UCLKSEL_MASK 0x00000018
#define CHIPC_CAP_UCLKSEL_SHIFT 3
#define CHIPC_CAP_UCLKSEL_UINTCLK 0x1
#define CHIPC_CAP_UARTGPIO 0x00000020
#define CHIPC_CAP_EXTBUS_MASK 0x000000c0
#define CHIPC_CAP_EXTBUS_SHIFT 6
#define CHIPC_CAP_EXTBUS_NONE 0x0
#define CHIPC_CAP_EXTBUS_FULL 0x1
#define CHIPC_CAP_EXTBUS_PROG 0x2
#define CHIPC_CAP_FLASH_MASK 0x00000700
#define CHIPC_CAP_FLASH_SHIFT 8
#define CHIPC_CAP_FLASH_NONE 0x0
#define CHIPC_CAP_SFLASH_ST 0x1
#define CHIPC_CAP_SFLASH_AT 0x2
#define CHIPC_CAP_NFLASH 0x3
#define CHIPC_CAP_PFLASH 0x7
#define CHIPC_CAP_PLL_MASK 0x00038000
#define CHIPC_CAP_PLL_SHIFT 15
#define CHIPC_CAP_PWR_CTL 0x00040000
#define CHIPC_CAP_OTP_SIZE_MASK 0x00380000
#define CHIPC_CAP_OTP_SIZE_SHIFT 19
#define CHIPC_CAP_OTP_SIZE_BASE 5
#define CHIPC_CAP_JTAGP 0x00400000
#define CHIPC_CAP_ROM 0x00800000
#define CHIPC_CAP_BKPLN64 0x08000000
#define CHIPC_CAP_PMU 0x10000000
#define CHIPC_CAP_ECI 0x20000000
#define CHIPC_CAP_SPROM 0x40000000
#define CHIPC_CAP_4706_NFLASH 0x80000000
#define CHIPC_CAP2_SECI 0x00000001
#define CHIPC_CAP2_GSIO 0x00000002
#define CHIPC_CAP2_GCI 0x00000004
#define CHIPC_CAP2_AOB 0x00000040
enum {
CHIPC_CST_DEFCIS_SEL = 0,
CHIPC_CST_SPROM_SEL = 1,
CHIPC_CST_OTP_SEL = 2,
CHIPC_CST_OTP_PWRDN = 3
};
#define CHIPC_CST_SPROM_OTP_SEL_R22_MASK 0x00000003
#define CHIPC_CST_SPROM_OTP_SEL_R22_SHIFT 0
#define CHIPC_CST_SPROM_OTP_SEL_R23_MASK 0x000000c0
#define CHIPC_CST_SPROM_OTP_SEL_R23_SHIFT 6
#define CHIPC_PLL_NONE 0x0
#define CHIPC_PLL_TYPE1 0x2
#define CHIPC_PLL_TYPE2 0x4
#define CHIPC_PLL_TYPE3 0x6
#define CHIPC_PLL_TYPE4 0x1
#define CHIPC_PLL_TYPE5 0x3
#define CHIPC_PLL_TYPE6 0x5
#define CHIPC_PLL_TYPE7 0x7
#define CHIPC_LPOMINFREQ 25000
#define CHIPC_LPOMAXFREQ 43000
#define CHIPC_XTALMINFREQ 19800000
#define CHIPC_XTALMAXFREQ 20200000
#define CHIPC_PCIMINFREQ 25000000
#define CHIPC_PCIMAXFREQ 34000000
#define CHIPC_ILP_DIV_5MHZ 0
#define CHIPC_ILP_DIV_1MHZ 4
#define CHIPC_PLL_DELAY 150
#define CHIPC_FREF_DELAY 200
#define CHIPC_MIN_SLOW_CLK 32
#define CHIPC_XTAL_ON_DELAY 1000
#define CHIPC_UARTCLKO 0x00000001
#define CHIPC_SE 0x00000002
#define CHIPC_UARTCLKEN 0x00000008
#define CHIPCTRL_4321A0_DEFAULT 0x3a4
#define CHIPCTRL_4321A1_DEFAULT 0x0a4
#define CHIPCTRL_4321_PLL_DOWN 0x800000
#define CHIPC_OTPS_OL_MASK 0x000000ff
#define CHIPC_OTPS_OL_MFG 0x00000001
#define CHIPC_OTPS_OL_OR1 0x00000002
#define CHIPC_OTPS_OL_OR2 0x00000004
#define CHIPC_OTPS_OL_GU 0x00000008
#define CHIPC_OTPS_GUP_MASK 0x00000f00
#define CHIPC_OTPS_GUP_SHIFT 8
#define CHIPC_OTPS_GUP_HW 0x00000100
#define CHIPC_OTPS_GUP_SW 0x00000200
#define CHIPC_OTPS_GUP_CI 0x00000400
#define CHIPC_OTPS_GUP_FUSE 0x00000800
#define CHIPC_OTPS_READY 0x00001000
#define CHIPC_OTPS_RV(x) (1 << (16 + (x)))
#define CHIPC_OTPS_RV_MASK 0x0fff0000
#define CHIPC_OTPC_PROGSEL 0x00000001
#define CHIPC_OTPC_PCOUNT_MASK 0x0000000e
#define CHIPC_OTPC_PCOUNT_SHIFT 1
#define CHIPC_OTPC_VSEL_MASK 0x000000f0
#define CHIPC_OTPC_VSEL_SHIFT 4
#define CHIPC_OTPC_TMM_MASK 0x00000700
#define CHIPC_OTPC_TMM_SHIFT 8
#define CHIPC_OTPC_ODM 0x00000800
#define CHIPC_OTPC_PROGEN 0x80000000
#define CHIPC_OTPP_COL_MASK 0x000000ff
#define CHIPC_OTPP_COL_SHIFT 0
#define CHIPC_OTPP_ROW_MASK 0x0000ff00
#define CHIPC_OTPP_ROW_SHIFT 8
#define CHIPC_OTPP_OC_MASK 0x0f000000
#define CHIPC_OTPP_OC_SHIFT 24
#define CHIPC_OTPP_READERR 0x10000000
#define CHIPC_OTPP_VALUE_MASK 0x20000000
#define CHIPC_OTPP_VALUE_SHIFT 29
#define CHIPC_OTPP_START_BUSY 0x80000000
#define CHIPC_OTPP_READ 0x40000000
#define CHIPC_OTPL_SIZE_MASK 0x0000f000
#define CHIPC_OTPL_SIZE_SHIFT 12
#define CHIPC_OTPL_GUP_MASK 0x00000FFF
#define CHIPC_OTPL_GUP_SHIFT 0
#define CHIPC_OTPL_CISFORMAT_NEW 0x80000000
#define CHIPC_OTPPOC_READ 0
#define CHIPC_OTPPOC_BIT_PROG 1
#define CHIPC_OTPPOC_VERIFY 3
#define CHIPC_OTPPOC_INIT 4
#define CHIPC_OTPPOC_SET 5
#define CHIPC_OTPPOC_RESET 6
#define CHIPC_OTPPOC_OCST 7
#define CHIPC_OTPPOC_ROW_LOCK 8
#define CHIPC_OTPPOC_PRESCN_TEST 9
#define CHIPC_JTAGM_CREV_OLD 10
#define CHIPC_JTAGM_CREV_IRP 22
#define CHIPC_JTAGM_CREV_RTI 28
#define CHIPC_JCMD_START 0x80000000
#define CHIPC_JCMD_BUSY 0x80000000
#define CHIPC_JCMD_STATE_MASK 0x60000000
#define CHIPC_JCMD_STATE_TLR 0x00000000
#define CHIPC_JCMD_STATE_PIR 0x20000000
#define CHIPC_JCMD_STATE_PDR 0x40000000
#define CHIPC_JCMD_STATE_RTI 0x60000000
#define CHIPC_JCMD0_ACC_MASK 0x0000f000
#define CHIPC_JCMD0_ACC_IRDR 0x00000000
#define CHIPC_JCMD0_ACC_DR 0x00001000
#define CHIPC_JCMD0_ACC_IR 0x00002000
#define CHIPC_JCMD0_ACC_RESET 0x00003000
#define CHIPC_JCMD0_ACC_IRPDR 0x00004000
#define CHIPC_JCMD0_ACC_PDR 0x00005000
#define CHIPC_JCMD0_IRW_MASK 0x00000f00
#define CHIPC_JCMD_ACC_MASK 0x000f0000
#define CHIPC_JCMD_ACC_IRDR 0x00000000
#define CHIPC_JCMD_ACC_DR 0x00010000
#define CHIPC_JCMD_ACC_IR 0x00020000
#define CHIPC_JCMD_ACC_RESET 0x00030000
#define CHIPC_JCMD_ACC_IRPDR 0x00040000
#define CHIPC_JCMD_ACC_PDR 0x00050000
#define CHIPC_JCMD_ACC_PIR 0x00060000
#define CHIPC_JCMD_ACC_IRDR_I 0x00070000
#define CHIPC_JCMD_ACC_DR_I 0x00080000
#define CHIPC_JCMD_IRW_MASK 0x00001f00
#define CHIPC_JCMD_IRW_SHIFT 8
#define CHIPC_JCMD_DRW_MASK 0x0000003f
#define CHIPC_JCTRL_FORCE_CLK 4
#define CHIPC_JCTRL_EXT_EN 2
#define CHIPC_JCTRL_EN 1
#define CHIPC_CLKD_SFLASH 0x0f000000
#define CHIPC_CLKD_SFLASH_SHIFT 24
#define CHIPC_CLKD_OTP 0x000f0000
#define CHIPC_CLKD_OTP_SHIFT 16
#define CHIPC_CLKD_JTAG 0x00000f00
#define CHIPC_CLKD_JTAG_SHIFT 8
#define CHIPC_CLKD_UART 0x000000ff
#define CHIPC_CLKD2_SPROM 0x00000003
#define CHIPC_CI_GPIO 0x00000001
#define CHIPC_CI_EI 0x00000002
#define CHIPC_CI_TEMP 0x00000004
#define CHIPC_CI_SIRQ 0x00000008
#define CHIPC_CI_PMU 0x00000020
#define CHIPC_CI_UART 0x00000040
#define CHIPC_CI_WDRESET 0x80000000
#define CHIPC_SCC_SS_MASK 0x00000007
#define CHIPC_SCC_SS_LPO 0x00000000
#define CHIPC_SCC_SS_XTAL 0x00000001
#define CHIPC_SCC_SS_PCI 0x00000002
#define CHIPC_SCC_LF 0x00000200
#define CHIPC_SCC_LP 0x00000400
#define CHIPC_SCC_FS 0x00000800
#define CHIPC_SCC_IP 0x00001000
#define CHIPC_SCC_XC 0x00002000
#define CHIPC_SCC_XP 0x00004000
#define CHIPC_SCC_CD_MASK 0xffff0000
#define CHIPC_SCC_CD_SHIFT 16
#define CHIPC_SYCC_IE 0x00000001
#define CHIPC_SYCC_AE 0x00000002
#define CHIPC_SYCC_FP 0x00000004
#define CHIPC_SYCC_AR 0x00000008
#define CHIPC_SYCC_HR 0x00000010
#define CHIPC_SYCC_CD_MASK 0xffff0000
#define CHIPC_SYCC_CD_SHIFT 16
#define CHIPC_BPIA_BYTEEN 0x0000000f
#define CHIPC_BPIA_SZ1 0x00000001
#define CHIPC_BPIA_SZ2 0x00000003
#define CHIPC_BPIA_SZ4 0x00000007
#define CHIPC_BPIA_SZ8 0x0000000f
#define CHIPC_BPIA_WRITE 0x00000100
#define CHIPC_BPIA_START 0x00000200
#define CHIPC_BPIA_BUSY 0x00000200
#define CHIPC_BPIA_ERROR 0x00000400
#define CHIPC_CF_EN 0x00000001
#define CHIPC_CF_EM_MASK 0x0000000e
#define CHIPC_CF_EM_SHIFT 1
#define CHIPC_CF_EM_FLASH 0
#define CHIPC_CF_EM_SYNC 2
#define CHIPC_CF_EM_PCMCIA 4
#define CHIPC_CF_DS 0x00000010
#define CHIPC_CF_BS 0x00000020
#define CHIPC_CF_CD_MASK 0x000000c0
#define CHIPC_CF_CD_SHIFT 6
#define CHIPC_CF_CD_DIV2 0x00000000
#define CHIPC_CF_CD_DIV3 0x00000040
#define CHIPC_CF_CD_DIV4 0x00000080
#define CHIPC_CF_CE 0x00000100
#define CHIPC_CF_SB 0x00000200
#define CHIPC_PM_W0_MASK 0x0000003f
#define CHIPC_PM_W1_MASK 0x00001f00
#define CHIPC_PM_W1_SHIFT 8
#define CHIPC_PM_W2_MASK 0x001f0000
#define CHIPC_PM_W2_SHIFT 16
#define CHIPC_PM_W3_MASK 0x1f000000
#define CHIPC_PM_W3_SHIFT 24
#define CHIPC_PA_W0_MASK 0x0000003f
#define CHIPC_PA_W1_MASK 0x00001f00
#define CHIPC_PA_W1_SHIFT 8
#define CHIPC_PA_W2_MASK 0x001f0000
#define CHIPC_PA_W2_SHIFT 16
#define CHIPC_PA_W3_MASK 0x1f000000
#define CHIPC_PA_W3_SHIFT 24
#define CHIPC_PI_W0_MASK 0x0000003f
#define CHIPC_PI_W1_MASK 0x00001f00
#define CHIPC_PI_W1_SHIFT 8
#define CHIPC_PI_W2_MASK 0x001f0000
#define CHIPC_PI_W2_SHIFT 16
#define CHIPC_PI_W3_MASK 0x1f000000
#define CHIPC_PI_W3_SHIFT 24
#define CHIPC_PW_W0_MASK 0x0000001f
#define CHIPC_PW_W1_MASK 0x00001f00
#define CHIPC_PW_W1_SHIFT 8
#define CHIPC_PW_W2_MASK 0x001f0000
#define CHIPC_PW_W2_SHIFT 16
#define CHIPC_PW_W3_MASK 0x1f000000
#define CHIPC_PW_W3_SHIFT 24
#define CHIPC_PW_W0 0x0000000c
#define CHIPC_PW_W1 0x00000a00
#define CHIPC_PW_W2 0x00020000
#define CHIPC_PW_W3 0x01000000
#define CHIPC_FW_W0_MASK 0x0000003f
#define CHIPC_FW_W1_MASK 0x00001f00
#define CHIPC_FW_W1_SHIFT 8
#define CHIPC_FW_W2_MASK 0x001f0000
#define CHIPC_FW_W2_SHIFT 16
#define CHIPC_FW_W3_MASK 0x1f000000
#define CHIPC_FW_W3_SHIFT 24
#define CHIPC_SRC_START 0x80000000
#define CHIPC_SRC_BUSY 0x80000000
#define CHIPC_SRC_OPCODE 0x60000000
#define CHIPC_SRC_OP_READ 0x00000000
#define CHIPC_SRC_OP_WRITE 0x20000000
#define CHIPC_SRC_OP_WRDIS 0x40000000
#define CHIPC_SRC_OP_WREN 0x60000000
#define CHIPC_SRC_OTPSEL 0x00000010
#define CHIPC_SRC_LOCK 0x00000008
#define CHIPC_SRC_SIZE_MASK 0x00000006
#define CHIPC_SRC_SIZE_1K 0x00000000
#define CHIPC_SRC_SIZE_4K 0x00000002
#define CHIPC_SRC_SIZE_16K 0x00000004
#define CHIPC_SRC_SIZE_SHIFT 1
#define CHIPC_SRC_PRESENT 0x00000001
#define CHIPC_GPIO_ONTIME_SHIFT 16
#define CHIPC_GPIOTIMERVAL_DEFAULT_ON 10
#define CHIPC_GPIOTIMERVAL_DEFAULT_OFF 90
#define CHIPC_GPIOTIMERVAL_DEFAULT \
((CHIPC_GPIOTIMERVAL_DEFAULT_ON << CHIPC_GPIO_ONTIME_SHIFT) | \
(CHIPC_GPIOTIMERVAL_DEFAULT_OFF))
#define CHIPC_CN_N1_MASK 0x3f
#define CHIPC_CN_N1_SHIFT 0
#define CHIPC_CN_N2_MASK 0x3f00
#define CHIPC_CN_N2_SHIFT 8
#define CHIPC_CN_PLLC_MASK 0xf0000
#define CHIPC_CN_PLLC_SHIFT 16
#define CHIPC_M1_MASK 0x3f
#define CHIPC_M1_SHIFT 0
#define CHIPC_M2_MASK 0x3f00
#define CHIPC_M2_SHIFT 8
#define CHIPC_M3_MASK 0x3f0000
#define CHIPC_M3_SHIFT 16
#define CHIPC_MC_MASK 0x1f000000
#define CHIPC_MC_SHIFT 24
#define CHIPC_F6_2 0x02
#define CHIPC_F6_3 0x03
#define CHIPC_F6_4 0x05
#define CHIPC_F6_5 0x09
#define CHIPC_F6_6 0x11
#define CHIPC_F6_7 0x21
#define CHIPC_F5_BIAS 5
#define CHIPC_MC_BYPASS 0x08
#define CHIPC_MC_M1 0x04
#define CHIPC_MC_M1M2 0x02
#define CHIPC_MC_M1M2M3 0x01
#define CHIPC_MC_M1M3 0x11
#define CHIPC_T2_BIAS 2
#define CHIPC_T2M2_BIAS 3
#define CHIPC_T2MC_M1BYP 1
#define CHIPC_T2MC_M2BYP 2
#define CHIPC_T2MC_M3BYP 4
#define CHIPC_T6_MMASK 1
#define CHIPC_T6_M0 120000000
#define CHIPC_T6_M1 100000000
#define CHIPC_SB2MIPS_T6(sb) (2 * (sb))
#define CHIPC_CLOCK_BASE1 24000000
#define CHIPC_CLOCK_BASE2 12500000
#define CHIPC_CLKC_5350_N 0x0311
#define CHIPC_CLKC_5350_M 0x04020009
#define CHIPC_CFG_EN 0x0001
#define CHIPC_CFG_EM_MASK 0x000e
#define CHIPC_CFG_EM_ASYNC 0x0000
#define CHIPC_CFG_EM_SYNC 0x0002
#define CHIPC_CFG_EM_PCMCIA 0x0004
#define CHIPC_CFG_EM_IDE 0x0006
#define CHIPC_FLASH_CFG_DS 0x0010
#define CHIPC_FLASH_CFG_CD_MASK 0x00e0
#define CHIPC_FLASH_CFG_CE 0x0100
#define CHIPC_FLASH_CFG_SB 0x0200
#define CHIPC_FLASH_CFG_IS 0x0400
#define CHIPC_EB_BASE 0x1a000000
#define CHIPC_EB_PCMCIA_MEM 0x1a000000
#define CHIPC_EB_PCMCIA_IO 0x1a200000
#define CHIPC_EB_PCMCIA_CFG 0x1a400000
#define CHIPC_EB_IDE 0x1a800000
#define CHIPC_EB_PCMCIA1_MEM 0x1a800000
#define CHIPC_EB_PCMCIA1_IO 0x1aa00000
#define CHIPC_EB_PCMCIA1_CFG 0x1ac00000
#define CHIPC_EB_PROGIF 0x1b000000
#define CHIPC_SFLASH_OPCODE 0x000000ff
#define CHIPC_SFLASH_ACTION 0x00000700
#define CHIPC_SFLASH_CS_ACTIVE 0x00001000
#define CHIPC_SFLASH_START 0x80000000
#define CHIPC_SFLASH_BUSY SFLASH_START
#define CHIPC_SFLASH_ACT_OPONLY 0x0000
#define CHIPC_SFLASH_ACT_OP1D 0x0100
#define CHIPC_SFLASH_ACT_OP3A 0x0200
#define CHIPC_SFLASH_ACT_OP3A1D 0x0300
#define CHIPC_SFLASH_ACT_OP3A4D 0x0400
#define CHIPC_SFLASH_ACT_OP3A4X4D 0x0500
#define CHIPC_SFLASH_ACT_OP3A1X4D 0x0700
#define CHIPC_SFLASH_ST_WREN 0x0006
#define CHIPC_SFLASH_ST_WRDIS 0x0004
#define CHIPC_SFLASH_ST_RDSR 0x0105
#define CHIPC_SFLASH_ST_WRSR 0x0101
#define CHIPC_SFLASH_ST_READ 0x0303
#define CHIPC_SFLASH_ST_PP 0x0302
#define CHIPC_SFLASH_ST_SE 0x02d8
#define CHIPC_SFLASH_ST_BE 0x00c7
#define CHIPC_SFLASH_ST_DP 0x00b9
#define CHIPC_SFLASH_ST_RES 0x03ab
#define CHIPC_SFLASH_ST_CSA 0x1000
#define CHIPC_SFLASH_ST_SSE 0x0220
#define CHIPC_SFLASH_ST_WIP 0x01
#define CHIPC_SFLASH_ST_WEL 0x02
#define CHIPC_SFLASH_ST_BP_MASK 0x1c
#define CHIPC_SFLASH_ST_BP_SHIFT 2
#define CHIPC_SFLASH_ST_SRWD 0x80
#define CHIPC_SFLASH_AT_READ 0x07e8
#define CHIPC_SFLASH_AT_PAGE_READ 0x07d2
#define CHIPC_SFLASH_AT_BUF1_READ
#define CHIPC_SFLASH_AT_BUF2_READ
#define CHIPC_SFLASH_AT_STATUS 0x01d7
#define CHIPC_SFLASH_AT_BUF1_WRITE 0x0384
#define CHIPC_SFLASH_AT_BUF2_WRITE 0x0387
#define CHIPC_SFLASH_AT_BUF1_ERASE_PROGRAM 0x0283
#define CHIPC_SFLASH_AT_BUF2_ERASE_PROGRAM 0x0286
#define CHIPC_SFLASH_AT_BUF1_PROGRAM 0x0288
#define CHIPC_SFLASH_AT_BUF2_PROGRAM 0x0289
#define CHIPC_SFLASH_AT_PAGE_ERASE 0x0281
#define CHIPC_SFLASH_AT_BLOCK_ERASE 0x0250
#define CHIPC_SFLASH_AT_BUF1_WRITE_ERASE_PROGRAM 0x0382
#define CHIPC_SFLASH_AT_BUF2_WRITE_ERASE_PROGRAM 0x0385
#define CHIPC_SFLASH_AT_BUF1_LOAD 0x0253
#define CHIPC_SFLASH_AT_BUF2_LOAD 0x0255
#define CHIPC_SFLASH_AT_BUF1_COMPARE 0x0260
#define CHIPC_SFLASH_AT_BUF2_COMPARE 0x0261
#define CHIPC_SFLASH_AT_BUF1_REPROGRAM 0x0258
#define CHIPC_SFLASH_AT_BUF2_REPROGRAM 0x0259
#define CHIPC_SFLASH_AT_READY 0x80
#define CHIPC_SFLASH_AT_MISMATCH 0x40
#define CHIPC_SFLASH_AT_ID_MASK 0x38
#define CHIPC_SFLASH_AT_ID_SHIFT 3
#define CHIPC_UART_RX 0
#define CHIPC_UART_TX 0
#define CHIPC_UART_DLL 0
#define CHIPC_UART_IER 1
#define CHIPC_UART_DLM 1
#define CHIPC_UART_IIR 2
#define CHIPC_UART_FCR 2
#define CHIPC_UART_LCR 3
#define CHIPC_UART_MCR 4
#define CHIPC_UART_LSR 5
#define CHIPC_UART_MSR 6
#define CHIPC_UART_SCR 7
#define CHIPC_UART_LCR_DLAB 0x80
#define CHIPC_UART_LCR_WLEN8 0x03
#define CHIPC_UART_MCR_OUT2 0x08
#define CHIPC_UART_MCR_LOOP 0x10
#define CHIPC_UART_LSR_RX_FIFO 0x80
#define CHIPC_UART_LSR_TDHR 0x40
#define CHIPC_UART_LSR_THRE 0x20
#define CHIPC_UART_LSR_BREAK 0x10
#define CHIPC_UART_LSR_FRAMING 0x08
#define CHIPC_UART_LSR_PARITY 0x04
#define CHIPC_UART_LSR_OVERRUN 0x02
#define CHIPC_UART_LSR_RXRDY 0x01
#define CHIPC_UART_FCR_FIFO_ENABLE 1
#define CHIPC_UART_IIR_FIFO_MASK 0xc0
#define CHIPC_UART_IIR_INT_MASK 0xf
#define CHIPC_UART_IIR_MDM_CHG 0x0
#define CHIPC_UART_IIR_NOINT 0x1
#define CHIPC_UART_IIR_THRE 0x2
#define CHIPC_UART_IIR_RCVD_DATA 0x4
#define CHIPC_UART_IIR_RCVR_STATUS 0x6
#define CHIPC_UART_IIR_CHAR_TIME 0xc
#define CHIPC_UART_IER_EDSSI 8
#define CHIPC_UART_IER_ELSI 4
#define CHIPC_UART_IER_ETBEI 2
#define CHIPC_UART_IER_ERBFI 1
#define CHIPC_CST4325_SPROM_OTP_SEL_MASK CHIPC_CST_SPROM_OTP_SEL_R22_MASK
#define CHIPC_CST4325_SPROM_OTP_SEL_SHIFT CHIPC_CST_SPROM_OTP_SEL_R22_SHIFT
#define CHIPC_CST4325_SDIO_USB_MODE_MASK 0x00000004
#define CHIPC_CST4325_SDIO_USB_MODE_SHIFT 2
#define CHIPC_CST4325_RCAL_VALID_MASK 0x00000008
#define CHIPC_CST4325_RCAL_VALID_SHIFT 3
#define CHIPC_CST4325_RCAL_VALUE_MASK 0x000001f0
#define CHIPC_CST4325_RCAL_VALUE_SHIFT 4
#define CHIPC_CST4325_PMUTOP_2B_MASK 0x00000200
#define CHIPC_CST4325_PMUTOP_2B_SHIFT 9
#define CHIPC_CST4329_SPROM_OTP_SEL_MASK CHIPC_CST_SPROM_OTP_SEL_R22_MASK
#define CHIPC_CST4329_SPROM_OTP_SEL_SHIFT CHIPC_CST_SPROM_OTP_SEL_R22_SHIFT
#define CHIPC_CST4329_SPI_SDIO_MODE_MASK 0x00000004
#define CHIPC_CST4329_SPI_SDIO_MODE_SHIFT 2
#define CHIPC_CST4312_SPROM_OTP_SEL_MASK CHIPC_CST_SPROM_OTP_SEL_R22_MASK
#define CHIPC_CST4312_SPROM_OTP_SEL_SHIFT CHIPC_CST_SPROM_OTP_SEL_R22_SHIFT
#define CHIPC_CST4322_XTAL_FREQ_20_40MHZ 0x00000020
#define CHIPC_CST4322_SPROM_OTP_SEL_MASK CHIPC_CST_SPROM_OTP_SEL_R23_MASK
#define CHIPC_CST4322_SPROM_OTP_SEL_SHIFT CHIPC_CST_SPROM_OTP_SEL_R23_SHIFT
#define CHIPC_CST4322_PCI_OR_USB 0x00000100
#define CHIPC_CST4322_BOOT_MASK 0x00000600
#define CHIPC_CST4322_BOOT_SHIFT 9
#define CHIPC_CST4322_BOOT_FROM_SRAM 0
#define CHIPC_CST4322_BOOT_FROM_ROM 1
#define CHIPC_CST4322_BOOT_FROM_FLASH 2
#define CHIPC_CST4322_BOOT_FROM_INVALID 3
#define CHIPC_CST4322_ILP_DIV_EN 0x00000800
#define CHIPC_CST4322_FLASH_TYPE_MASK 0x00001000
#define CHIPC_CST4322_FLASH_TYPE_SHIFT 12
#define CHIPC_CST4322_FLASH_TYPE_SHIFT_ST 0
#define CHIPC_CST4322_FLASH_TYPE_SHIFT_ATMEL 1
#define CHIPC_CST4322_ARM_TAP_SEL 0x00002000
#define CHIPC_CST4322_RES_INIT_MODE_MASK 0x0000c000
#define CHIPC_CST4322_RES_INIT_MODE_SHIFT 14
#define CHIPC_CST4322_RES_INIT_MODE_ILPAVAIL 0
#define CHIPC_CST4322_RES_INIT_MODE_ILPREQ 1
#define CHIPC_CST4322_RES_INIT_MODE_ALPAVAIL 2
#define CHIPC_CST4322_RES_INIT_MODE_HTAVAIL 3
#define CHIPC_CST4322_PCIPLLCLK_GATING 0x00010000
#define CHIPC_CST4322_CLK_SWITCH_PCI_TO_ALP 0x00020000
#define CHIPC_CST4322_PCI_CARDBUS_MODE 0x00040000
#define CHIPC_CST43236_SFLASH_MASK 0x00000040
#define CHIPC_CST43236_OTP_SEL_MASK 0x00000080
#define CHIPC_CST43236_OTP_SEL_SHIFT 7
#define CHIPC_CST43236_HSIC_MASK 0x00000100
#define CHIPC_CST43236_BP_CLK 0x00000200
#define CHIPC_CST43236_BOOT_MASK 0x00001800
#define CHIPC_CST43236_BOOT_SHIFT 11
#define CHIPC_CST43236_BOOT_FROM_SRAM 0
#define CHIPC_CST43236_BOOT_FROM_ROM 1
#define CHIPC_CST43236_BOOT_FROM_FLASH 2
#define CHIPC_CST43236_BOOT_FROM_INVALID 3
#define CHIPC_CST43237_BP_CLK 0x00000200
#define CHIPC_CST4331_XTAL_FREQ 0x00000001
#define CHIPC_CST4331_SPROM_PRESENT 0x00000002
#define CHIPC_CST4331_OTP_PRESENT 0x00000004
#define CHIPC_CST4331_LDO_RF 0x00000008
#define CHIPC_CST4331_LDO_PAR 0x00000010
#define CHIPC_CCTRL4331_BT_COEXIST (1<<0)
#define CHIPC_CCTRL4331_SECI (1<<1)
#define CHIPC_CCTRL4331_EXT_LNA (1<<2)
#define CHIPC_CCTRL4331_SPROM_GPIO13_15 (1<<3)
#define CHIPC_CCTRL4331_EXTPA_EN (1<<4)
#define CHIPC_CCTRL4331_GPIOCLK_ON_SPROMCS (1<<5)
#define CHIPC_CCTRL4331_PCIE_MDIO_ON_SPROMCS (1<<6)
#define CHIPC_CCTRL4331_EXTPA_ON_GPIO2_5 (1<<7)
#define CHIPC_CCTRL4331_OVR_PIPEAUXCLKEN (1<<8)
#define CHIPC_CCTRL4331_OVR_PIPEAUXPWRDOWN (1<<9)
#define CHIPC_CCTRL4331_PCIE_AUXCLKEN (1<<10)
#define CHIPC_CCTRL4331_PCIE_PIPE_PLLDOWN (1<<11)
#define CHIPC_CCTRL4331_EXTPA_EN2 (1<<12)
#define CHIPC_CCTRL4331_BT_SHD0_ON_GPIO4 (1<<16)
#define CHIPC_CCTRL4331_BT_SHD1_ON_GPIO5 (1<<17)
#define CHIPC_CST4315_SPROM_OTP_SEL_MASK CHIPC_CST_SPROM_OTP_SEL_R22_MASK
#define CHIPC_CST4315_SPROM_OTP_SEL_SHIFT CHIPC_CST_SPROM_OTP_SEL_R22_SHIFT
#define CHIPC_CST4315_SDIO_MODE 0x00000004
#define CHIPC_CST4315_RCAL_VALID 0x00000008
#define CHIPC_CST4315_RCAL_VALUE_MASK 0x000001f0
#define CHIPC_CST4315_RCAL_VALUE_SHIFT 4
#define CHIPC_CST4315_PALDO_EXTPNP 0x00000200
#define CHIPC_CST4315_CBUCK_MODE_MASK 0x00000c00
#define CHIPC_CST4315_CBUCK_MODE_BURST 0x00000400
#define CHIPC_CST4315_CBUCK_MODE_LPBURST 0x00000c00
#define CHIPC_CST4319_SPI_CPULESSUSB 0x00000001
#define CHIPC_CST4319_SPI_CLK_POL 0x00000002
#define CHIPC_CST4319_SPI_CLK_PH 0x00000008
#define CHIPC_CST4319_SPROM_OTP_SEL_MASK CHIPC_CST_SPROM_OTP_SEL_R23_MASK
#define CHIPC_CST4319_SPROM_OTP_SEL_SHIFT CHIPC_CST_SPROM_OTP_SEL_R23_SHIFT
#define CHIPC_CST4319_SDIO_USB_MODE 0x00000100
#define CHIPC_CST4319_REMAP_SEL_MASK 0x00000600
#define CHIPC_CST4319_ILPDIV_EN 0x00000800
#define CHIPC_CST4319_XTAL_PD_POL 0x00001000
#define CHIPC_CST4319_LPO_SEL 0x00002000
#define CHIPC_CST4319_RES_INIT_MODE 0x0000c000
#define CHIPC_CST4319_PALDO_EXTPNP 0x00010000
#define CHIPC_CST4319_CBUCK_MODE_MASK 0x00060000
#define CHIPC_CST4319_CBUCK_MODE_BURST 0x00020000
#define CHIPC_CST4319_CBUCK_MODE_LPBURST 0x00060000
#define CHIPC_CST4319_RCAL_VALID 0x01000000
#define CHIPC_CST4319_RCAL_VALUE_MASK 0x3e000000
#define CHIPC_CST4319_RCAL_VALUE_SHIFT 25
#define CHIPC_CST4336_SPI_MODE_MASK 0x00000001
#define CHIPC_CST4336_SPROM_PRESENT 0x00000002
#define CHIPC_CST4336_OTP_PRESENT 0x00000004
#define CHIPC_CST4336_ARMREMAP_0 0x00000008
#define CHIPC_CST4336_ILPDIV_EN_MASK 0x00000010
#define CHIPC_CST4336_ILPDIV_EN_SHIFT 4
#define CHIPC_CST4336_XTAL_PD_POL_MASK 0x00000020
#define CHIPC_CST4336_XTAL_PD_POL_SHIFT 5
#define CHIPC_CST4336_LPO_SEL_MASK 0x00000040
#define CHIPC_CST4336_LPO_SEL_SHIFT 6
#define CHIPC_CST4336_RES_INIT_MODE_MASK 0x00000180
#define CHIPC_CST4336_RES_INIT_MODE_SHIFT 7
#define CHIPC_CST4336_CBUCK_MODE_MASK 0x00000600
#define CHIPC_CST4336_CBUCK_MODE_SHIFT 9
#define CHIPC_CST4330_CHIPMODE_SDIOD(cs) (((cs) & 0x7) < 6)
#define CHIPC_CST4330_CHIPMODE_USB20D(cs) (((cs) & 0x7) >= 6)
#define CHIPC_CST4330_CHIPMODE_SDIO(cs) (((cs) & 0x4) == 0)
#define CHIPC_CST4330_CHIPMODE_GSPI(cs) (((cs) & 0x6) == 4)
#define CHIPC_CST4330_CHIPMODE_USB(cs) (((cs) & 0x7) == 6)
#define CHIPC_CST4330_CHIPMODE_USBDA(cs) (((cs) & 0x7) == 7)
#define CHIPC_CST4330_OTP_PRESENT 0x00000010
#define CHIPC_CST4330_LPO_AUTODET_EN 0x00000020
#define CHIPC_CST4330_ARMREMAP_0 0x00000040
#define CHIPC_CST4330_SPROM_PRESENT 0x00000080
#define CHIPC_CST4330_ILPDIV_EN 0x00000100
#define CHIPC_CST4330_LPO_SEL 0x00000200
#define CHIPC_CST4330_RES_INIT_MODE_SHIFT 10
#define CHIPC_CST4330_RES_INIT_MODE_MASK 0x00000c00
#define CHIPC_CST4330_CBUCK_MODE_SHIFT 12
#define CHIPC_CST4330_CBUCK_MODE_MASK 0x00003000
#define CHIPC_CST4330_CBUCK_POWER_OK 0x00004000
#define CHIPC_CST4330_BB_PLL_LOCKED 0x00008000
#define CHIPC_SOCDEVRAM_4330_BP_ADDR 0x1E000000
#define CHIPC_SOCDEVRAM_4330_ARM_ADDR 0x00800000
#define CHIPC_CST4313_SPROM_PRESENT 1
#define CHIPC_CST4313_OTP_PRESENT 2
#define CHIPC_CST4313_SPROM_OTP_SEL_MASK 0x00000002
#define CHIPC_CST4313_SPROM_OTP_SEL_SHIFT 0
#define CHIPC_CST43228_ILP_DIV_EN 0x1
#define CHIPC_CST43228_OTP_PRESENT 0x2
#define CHIPC_CST43228_SERDES_REFCLK_PADSEL 0x4
#define CHIPC_CST43228_SDIO_MODE 0x8
#define CHIPC_CST43228_SDIO_OTP_PRESENT 0x10
#define CHIPC_CST43228_SDIO_RESET 0x20
#define CHIPC_CST4706_LOWCOST_PKG (1<<0)
#define CHIPC_CST4706_SFLASH_PRESENT (1<<1)
#define CHIPC_CST4706_SFLASH_TYPE (1<<2)
#define CHIPC_CST4706_MIPS_BENDIAN (1<<3)
#define CHIPC_CST4706_PCIE1_DISABLE (1<<5)
#define CHIPC_FLSTRCF4706_MASK 0x000000ff
#define CHIPC_FLSTRCF4706_SF1 0x00000001
#define CHIPC_FLSTRCF4706_PF1 0x00000002
#define CHIPC_FLSTRCF4706_SF1_TYPE 0x00000004
#define CHIPC_FLSTRCF4706_NF1 0x00000008
#define CHIPC_FLSTRCF4706_1ST_MADDR_SEG_MASK 0x000000f0
#define CHIPC_FLSTRCF4706_1ST_MADDR_SEG_SHIFT 4
#define CHIPC_FLSTRCF4706_1ST_MADDR_SEG_4MB 0x1
#define CHIPC_FLSTRCF4706_1ST_MADDR_SEG_8MB 0x2
#define CHIPC_FLSTRCF4706_1ST_MADDR_SEG_16MB 0x3
#define CHIPC_FLSTRCF4706_1ST_MADDR_SEG_32MB 0x4
#define CHIPC_FLSTRCF4706_1ST_MADDR_SEG_64MB 0x5
#define CHIPC_FLSTRCF4706_1ST_MADDR_SEG_128MB 0x6
#define CHIPC_FLSTRCF4706_1ST_MADDR_SEG_256MB 0x7
#define CHIPC_BT_ACL 0x00
#define CHIPC_BT_SCO 0x01
#define CHIPC_BT_eSCO 0x02
#define CHIPC_BT_A2DP 0x03
#define CHIPC_BT_SNIFF 0x04
#define CHIPC_BT_PAGE_SCAN 0x05
#define CHIPC_BT_INQUIRY_SCAN 0x06
#define CHIPC_BT_PAGE 0x07
#define CHIPC_BT_INQUIRY 0x08
#define CHIPC_BT_MSS 0x09
#define CHIPC_BT_PARK 0x0a
#define CHIPC_BT_RSSISCAN 0x0b
#define CHIPC_BT_MD_ACL 0x0c
#define CHIPC_BT_MD_eSCO 0x0d
#define CHIPC_BT_SCAN_WITH_SCO_LINK 0x0e
#define CHIPC_BT_SCAN_WITHOUT_SCO_LINK 0x0f
#define CHIPC_BT_MASTER 0
#define CHIPC_BT_SLAVE 1
#define CHIPC_BT_LOWEST_PRIO 0x0
#define CHIPC_BT_HIGHEST_PRIO 0x3
#endif