#ifndef _DOVEREG_H_
#define _DOVEREG_H_
#include <arm/marvell/mvsocreg.h>
#define DOVE_UNITID_DDR MVSOC_UNITID_DDR
#define DOVE_UNITID_DEVBUS MVSOC_UNITID_DEVBUS
#define DOVE_UNITID_DB 0x2
#define DOVE_UNITID_SA 0x3
#define DOVE_UNITID_PEX MVSOC_UNITID_PEX
#define DOVE_UNITID_USB 0x5
#define DOVE_UNITID_XOR 0x6
#define DOVE_UNITID_GBE 0x7
#define DOVE_UNITID_PEX1 0x8
#define DOVE_UNITID_SDIO 0x9
#define DOVE_UNITID_SATA 0xa
#define DOVE_UNITID_I2S 0xb
#define DOVE_UNITID_NAND 0xc
#define DOVE_UNITID_PMU 0xd
#define DOVE_UNITID_AC97 0xe
#define DOVE_ATTR_PEX_MEM 0xe8
#define DOVE_ATTR_PEX_IO 0xe0
#define DOVE_ATTR_SA 0x00
#define DOVE_ATTR_SPI0 0xfe
#define DOVE_ATTR_SPI1 0xfb
#define DOVE_ATTR_BOOTROM 0xfd
#define DOVE_ATTR_NAND 0x00
#define DOVE_ATTR_PMU 0x00
#define DOVE_IRQ_BRIDGE 0
#define DOVE_IRQ_H2CPUDB 1
#define DOVE_IRQ_CPU2HDB 2
#define DOVE_IRQ_NF 3
#define DOVE_IRQ_PDMA 4
#define DOVE_IRQ_SPI1 5
#define DOVE_IRQ_SPI0 6
#define DOVE_IRQ_UART0 7
#define DOVE_IRQ_UART1 8
#define DOVE_IRQ_UART2 9
#define DOVE_IRQ_UART3 10
#define DOVE_IRQ_TWSI 11
#define DOVE_IRQ_GPIO7_0 12
#define DOVE_IRQ_GPIO15_8 13
#define DOVE_IRQ_GPIO23_16 14
#define DOVE_IRQ_PEX0_ERR 15
#define DOVE_IRQ_PEX0_INT 16
#define DOVE_IRQ_PEX1_ERR 17
#define DOVE_IRQ_PEX1_INT 18
#define DOVE_IRQ_AUDIO0_INT 19
#define DOVE_IRQ_AUDIO0_ERR 20
#define DOVE_IRQ_AUDIO1_INT 21
#define DOVE_IRQ_AUDIO1_ERR 22
#define DOVE_IRQ_USBBR 23
#define DOVE_IRQ_USB0CNT 24
#define DOVE_IRQ_USB1CNT 25
#define DOVE_IRQ_GBERX 26
#define DOVE_IRQ_GBETX 27
#define DOVE_IRQ_GBEMISC 28
#define DOVE_IRQ_GBESUM 29
#define DOVE_IRQ_GBEERR 30
#define DOVE_IRQ_SECURITYINT 31
#define DOVE_IRQ_AC97 32
#define DOVE_IRQ_PMU 33
#define DOVE_IRQ_CAM 34
#define DOVE_IRQ_SD0 35
#define DOVE_IRQ_SD1 36
#define DOVE_IRQ_XOR0_DMA0 39
#define DOVE_IRQ_XOR0_DMA1 40
#define DOVE_IRQ_XOR0ERR 41
#define DOVE_IRQ_XOR1_DMA0 42
#define DOVE_IRQ_XOR1_DMA1 43
#define DOVE_IRQ_XOR1ERR 44
#define DOVE_IRQ_IRE_DCON 45
#define DOVE_IRQ_LCD1 46
#define DOVE_IRQ_LCD0 47
#define DOVE_IRQ_GPU 48
#define DOVE_IRQ_VMETA 51
#define DOVE_IRQ_SSPTIMER 54
#define DOVE_IRQ_SSPINT 55
#define DOVE_IRQ_MEMORYERR 56
#define DOVE_IRQ_DWNSTRMEXCLTM 57
#define DOVE_IRQ_UPSTRMADDERR 58
#define DOVE_IRQ_SECURITYERR 59
#define DOVE_IRQ_GPIO_31_24 60
#define DOVE_IRQ_HIGHGPIO 61
#define DOVE_IRQ_SATAINT 62
#define DOVE_UNITID2PHYS(uid) ((DOVE_UNITID_ ## uid) << 16)
#define DOVE_SPI0_BASE (MVSOC_DEVBUS_BASE + 0x0600)
#define DOVE_SPI1_BASE (MVSOC_DEVBUS_BASE + 0x4600)
#define DOVE_COM2_BASE (MVSOC_DEVBUS_BASE + 0x2200)
#define DOVE_COM3_BASE (MVSOC_DEVBUS_BASE + 0x2300)
#define DOVE_DB_BASE (DOVE_UNITID2PHYS(DB))
#define DOVE_DB_NWINDOW 8
#define DOVE_DB_NREMAP 4
#define DOVE_DB_MICR 0x200
#define DOVE_DB_MIRQIMR 0x204
#define DOVE_DB_MFIQIMR 0x208
#define DOVE_DB_EIMR 0x20c
#define DOVE_DB_SMICR 0x210
#define DOVE_DB_SMIRQIMR 0x214
#define DOVE_DB_SMFIQIMR 0x218
#define DOVE_DB_SEIMR 0x21c
#define DOVE_DB_PCIEIMR 0x220
#define DOVE_CESA_BASE (DOVE_UNITID2PHYS(SA) + 0xd000)
#define DOVE_USB0_BASE (DOVE_UNITID2PHYS(USB))
#define DOVE_USB1_BASE (DOVE_UNITID2PHYS(USB) + 0x1000)
#define DOVE_XORE_BASE (DOVE_UNITID2PHYS(XOR))
#define DOVE_GBE_BASE (DOVE_UNITID2PHYS(GBE))
#define DOVE_PEX1_BASE (DOVE_UNITID2PHYS(PEX1))
#define DOVE_SDHC_SIZE 0x2000
#define DOVE_SDHC1_BASE (DOVE_UNITID2PHYS(SDIO))
#define DOVE_SDHC0_BASE (DOVE_SDHC1_BASE + DOVE_SDHC_SIZE)
#define DOVE_CAMERA_BASE (DOVE_SDHC0_BASE + DOVE_SDHC_SIZE)
#define DOVE_SATAHC_BASE (DOVE_UNITID2PHYS(SATA))
#define DOVE_AUDIO0_BASE (DOVE_UNITID2PHYS(I2S))
#define DOVE_AUDIO1_BASE (DOVE_UNITID2PHYS(I2S) + 0x4000)
#define DOVE_NAND_BASE (DOVE_UNITID2PHYS(NAND))
#define DOVE_PMU_BASE (DOVE_UNITID2PHYS(PMU))
#define DOVE_MISC_BASE (DOVE_UNITID2PHYS(PMU) + 0x0200)
#define DOVE_GPIO_BASE (DOVE_UNITID2PHYS(PMU) + 0x0400)
#define DOVE_PMU_BASE2 (DOVE_UNITID2PHYS(PMU) + 0x8000)
#define DOVE_RTC_BASE (DOVE_UNITID2PHYS(PMU) + 0x8500)
#define DOVE_PMU_SRAM_BASE (DOVE_UNITID2PHYS(PMU) + 0xc000)
#define DOVE_PMU_SRAM_SIZE 0x800
#define DOVE_PMU_SIZE 0x200
#define DOVE_PMU_CPUSDFSCR 0x00
#define DOVE_PMU_CPUSDFSCR_DFSEN (1 << 0)
#define DOVE_PMU_CPUSDFSCR_CPUSLOWEN (1 << 1)
#define DOVE_PMU_CPUSDFSCR_DDRLRATIO(x) (((x) & 0x3f) << 3)
#define DOVE_PMU_CPUSDFSCR_CPUL2CR(x) (((x) & 0x3f) << 9)
#define DOVE_PMU_CPUSDFSCR_CHNGPLLEN (1 << 16)
#define DOVE_PMU_CPUSDFSSR 0x04
#define DOVE_PMU_CPUSDFSSR_CPUSLOWMODESTTS_MASK (1 << 1)
#define DOVE_PMU_CPUSDFSSR_CPUSLOWMODESTTS_TURBO (0 << 1)
#define DOVE_PMU_CPUSDFSSR_CPUSLOWMODESTTS_SLOW (1 << 1)
#define DOVE_PMU_TM_BASE 0x1c
#define DOVE_PMU_CGCR 0x38
#define DOVE_PMU_CPUCDC0R 0x44
#define DOVE_PMU_CPUCDC0R_DPRATIO(x) (((x) >> 24) & 0x3f)
#define DOVE_PMU_CPUCDC0R_XPRATIO(x) (((x) >> 16) & 0x3f)
#define DOVE_PMU_CPUCDC0R_BPRATIO(x) (((x) >> 8) & 0x3f)
#define DOVE_PMU_CPUCDC0R_PPRATIO(x) (((x) >> 0) & 0x3f)
#define DOVE_PMU_PMUICR 0x50
#define DOVE_PMU_PMUIMR 0x54
#define DOVE_PMU_PMUI_DFSDONE (1 << 0)
#define DOVE_PMU_PMUI_DVSDONE (1 << 1)
#define DOVE_PMU_PMUI_THERMCOOLING (1 << 3)
#define DOVE_PMU_PMUI_THERMOVERHEAT (1 << 4)
#define DOVE_PMU_PMUI_RTCALARM (1 << 5)
#define DOVE_PMU_PMUI_BATTFAULT (1 << 6)
#define DOVE_PMU_TDC0R 0x5c
#define DOVE_PMU_TDC0R_THERMSLEEP (1 << 30)
#define DOVE_PMU_TDC0R_THERMOTFCALB (1 << 29)
#define DOVE_PMU_TDC0R_THERMDOUBLESLOPE (1 << 28)
#define DOVE_PMU_TDC0R_THERMAVGNUM_MASK (0x7 << 25)
#define DOVE_PMU_TDC0R_THERMAVGNUM_NO (0x0 << 25)
#define DOVE_PMU_TDC0R_THERMAVGNUM_2 (0x1 << 25)
#define DOVE_PMU_TDC0R_THERMAVGNUM_4 (0x2 << 25)
#define DOVE_PMU_TDC0R_THERMAVGNUM_8 (0x3 << 25)
#define DOVE_PMU_TDC0R_THERMAVGNUM_16 (0x4 << 25)
#define DOVE_PMU_TDC0R_THERMAVGNUM_32 (0x5 << 25)
#define DOVE_PMU_TDC0R_THERMSELCALCAPSRC_MASK (0x7 << 20)
#define DOVE_PMU_TDC0R_THERMREFCALCOUNT_MASK (0x1ff << 11)
#define DOVE_PMU_TDC0R_THERMREFCALCOUNT(x) ((x) << 11)
#define DOVE_PMU_TDC0R_THERMATEST (0x3 << 10)
#define DOVE_PMU_TDC0R_THERMSELIREF (1 << 8)
#define DOVE_PMU_TDC0R_THERMVBEBYPASS (1 << 7)
#define DOVE_PMU_TDC0R_THERMSELVCAL_MASK (0x3 << 5)
#define DOVE_PMU_TDC0R_THERMSELVCAL(x) ((x) << 5)
#define DOVE_PMU_TDC0R_THERMTCTRIP (0x7 << 2)
#define DOVE_PMU_TDC0R_THERMSOFTRESET (1 << 1)
#define DOVE_PMU_TDC0R_THERMPOWERDOWN (1 << 0)
#define DOVE_PMU_TDC1R 0x60
#define DOVE_PMU_PMUCR 0x00
#define DOVE_PMU_PMUCR_MASKFIQ (1 << 28)
#define DOVE_PMU_PMUCR_MASKIRQ (1 << 24)
#define DOVE_PMU_PMUCR_MCSLEEPREQACK (1 << 19)
#define DOVE_PMU_PMUCR_MCSLEEPREQ (1 << 18)
#define DOVE_PMU_PMUCR_MCHALTREQACK (1 << 17)
#define DOVE_PMU_PMUCR_MCHALTREQ (1 << 16)
#define DOVE_PMU_PMUCR_DDRSELFREFEN (1 << 5)
#define DOVE_PMU_PMUCR_STDBYPWREN (1 << 4)
#define DOVE_PMU_PMUCR_DEEPIDLEPWREN (1 << 3)
#define DOVE_PMU_PMUCR_EBOOKMODE (1 << 2)
#define DOVE_PMU_PMUCR_MEMRETENTIONEN (1 << 0)
#define DOVE_MISC_SAMPLE_AT_RESET0 0x14
#define DOVE_AC97_BASE (DOVE_UNITID2PHYS(AC97))
#define DOVE_SSP_BASE (DOVE_UNITID2PHYS(AC97) + 0xc000)
#endif