18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright 2008 Cavium Networks
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef __MACH_BOARD_CNS3XXXH
78c2ecf20Sopenharmony_ci#define __MACH_BOARD_CNS3XXXH
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci/*
108c2ecf20Sopenharmony_ci * Memory map
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci#define CNS3XXX_FLASH_BASE			0x10000000	/* Flash/SRAM Memory Bank 0 */
138c2ecf20Sopenharmony_ci#define CNS3XXX_FLASH_SIZE			SZ_256M
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define CNS3XXX_DDR2SDRAM_BASE			0x20000000	/* DDR2 SDRAM Memory */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define CNS3XXX_SPI_FLASH_BASE			0x60000000	/* SPI Serial Flash Memory */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define CNS3XXX_SWITCH_BASE			0x70000000	/* Switch and HNAT Control */
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define CNS3XXX_PPE_BASE			0x70001000	/* HANT	*/
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#define CNS3XXX_EMBEDDED_SRAM_BASE		0x70002000	/* HANT Embedded SRAM */
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define CNS3XXX_SSP_BASE			0x71000000	/* Synchronous Serial Port - SPI/PCM/I2C */
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#define CNS3XXX_DMC_BASE			0x72000000	/* DMC Control (DDR2 SDRAM) */
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#define CNS3XXX_SMC_BASE			0x73000000	/* SMC Control */
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#define SMC_MEMC_STATUS_OFFSET			0x000
328c2ecf20Sopenharmony_ci#define SMC_MEMIF_CFG_OFFSET			0x004
338c2ecf20Sopenharmony_ci#define SMC_MEMC_CFG_SET_OFFSET			0x008
348c2ecf20Sopenharmony_ci#define SMC_MEMC_CFG_CLR_OFFSET			0x00C
358c2ecf20Sopenharmony_ci#define SMC_DIRECT_CMD_OFFSET			0x010
368c2ecf20Sopenharmony_ci#define SMC_SET_CYCLES_OFFSET			0x014
378c2ecf20Sopenharmony_ci#define SMC_SET_OPMODE_OFFSET			0x018
388c2ecf20Sopenharmony_ci#define SMC_REFRESH_PERIOD_0_OFFSET		0x020
398c2ecf20Sopenharmony_ci#define SMC_REFRESH_PERIOD_1_OFFSET		0x024
408c2ecf20Sopenharmony_ci#define SMC_SRAM_CYCLES0_0_OFFSET		0x100
418c2ecf20Sopenharmony_ci#define SMC_NAND_CYCLES0_0_OFFSET		0x100
428c2ecf20Sopenharmony_ci#define SMC_OPMODE0_0_OFFSET			0x104
438c2ecf20Sopenharmony_ci#define SMC_SRAM_CYCLES0_1_OFFSET		0x120
448c2ecf20Sopenharmony_ci#define SMC_NAND_CYCLES0_1_OFFSET		0x120
458c2ecf20Sopenharmony_ci#define SMC_OPMODE0_1_OFFSET			0x124
468c2ecf20Sopenharmony_ci#define SMC_USER_STATUS_OFFSET			0x200
478c2ecf20Sopenharmony_ci#define SMC_USER_CONFIG_OFFSET			0x204
488c2ecf20Sopenharmony_ci#define SMC_ECC_STATUS_OFFSET			0x300
498c2ecf20Sopenharmony_ci#define SMC_ECC_MEMCFG_OFFSET			0x304
508c2ecf20Sopenharmony_ci#define SMC_ECC_MEMCOMMAND1_OFFSET		0x308
518c2ecf20Sopenharmony_ci#define SMC_ECC_MEMCOMMAND2_OFFSET		0x30C
528c2ecf20Sopenharmony_ci#define SMC_ECC_ADDR0_OFFSET			0x310
538c2ecf20Sopenharmony_ci#define SMC_ECC_ADDR1_OFFSET			0x314
548c2ecf20Sopenharmony_ci#define SMC_ECC_VALUE0_OFFSET			0x318
558c2ecf20Sopenharmony_ci#define SMC_ECC_VALUE1_OFFSET			0x31C
568c2ecf20Sopenharmony_ci#define SMC_ECC_VALUE2_OFFSET			0x320
578c2ecf20Sopenharmony_ci#define SMC_ECC_VALUE3_OFFSET			0x324
588c2ecf20Sopenharmony_ci#define SMC_PERIPH_ID_0_OFFSET			0xFE0
598c2ecf20Sopenharmony_ci#define SMC_PERIPH_ID_1_OFFSET			0xFE4
608c2ecf20Sopenharmony_ci#define SMC_PERIPH_ID_2_OFFSET			0xFE8
618c2ecf20Sopenharmony_ci#define SMC_PERIPH_ID_3_OFFSET			0xFEC
628c2ecf20Sopenharmony_ci#define SMC_PCELL_ID_0_OFFSET			0xFF0
638c2ecf20Sopenharmony_ci#define SMC_PCELL_ID_1_OFFSET			0xFF4
648c2ecf20Sopenharmony_ci#define SMC_PCELL_ID_2_OFFSET			0xFF8
658c2ecf20Sopenharmony_ci#define SMC_PCELL_ID_3_OFFSET			0xFFC
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci#define CNS3XXX_GPIOA_BASE			0x74000000	/* GPIO port A */
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci#define CNS3XXX_GPIOB_BASE			0x74800000	/* GPIO port B */
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci#define CNS3XXX_RTC_BASE			0x75000000	/* Real Time Clock */
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#define RTC_SEC_OFFSET				0x00
748c2ecf20Sopenharmony_ci#define RTC_MIN_OFFSET				0x04
758c2ecf20Sopenharmony_ci#define RTC_HOUR_OFFSET				0x08
768c2ecf20Sopenharmony_ci#define RTC_DAY_OFFSET				0x0C
778c2ecf20Sopenharmony_ci#define RTC_SEC_ALM_OFFSET			0x10
788c2ecf20Sopenharmony_ci#define RTC_MIN_ALM_OFFSET			0x14
798c2ecf20Sopenharmony_ci#define RTC_HOUR_ALM_OFFSET			0x18
808c2ecf20Sopenharmony_ci#define RTC_REC_OFFSET				0x1C
818c2ecf20Sopenharmony_ci#define RTC_CTRL_OFFSET				0x20
828c2ecf20Sopenharmony_ci#define RTC_INTR_STS_OFFSET			0x34
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci#define CNS3XXX_MISC_BASE			0x76000000	/* Misc Control */
858c2ecf20Sopenharmony_ci#define CNS3XXX_MISC_BASE_VIRT			0xFB000000	/* Misc Control */
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci#define CNS3XXX_PM_BASE				0x77000000	/* Power Management Control */
888c2ecf20Sopenharmony_ci#define CNS3XXX_PM_BASE_VIRT			0xFB001000
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci#define PM_CLK_GATE_OFFSET			0x00
918c2ecf20Sopenharmony_ci#define PM_SOFT_RST_OFFSET			0x04
928c2ecf20Sopenharmony_ci#define PM_HS_CFG_OFFSET			0x08
938c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_OFFSET			0x0C
948c2ecf20Sopenharmony_ci#define PM_PWR_STA_OFFSET			0x10
958c2ecf20Sopenharmony_ci#define PM_SYS_CLK_CTRL_OFFSET			0x14
968c2ecf20Sopenharmony_ci#define PM_PLL_LCD_I2S_CTRL_OFFSET		0x18
978c2ecf20Sopenharmony_ci#define PM_PLL_HM_PD_OFFSET			0x1C
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci#define CNS3XXX_UART0_BASE			0x78000000	/* UART 0 */
1008c2ecf20Sopenharmony_ci#define CNS3XXX_UART0_BASE_VIRT			0xFB002000
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci#define CNS3XXX_UART1_BASE			0x78400000	/* UART 1 */
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci#define CNS3XXX_UART2_BASE			0x78800000	/* UART 2 */
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci#define CNS3XXX_DMAC_BASE			0x79000000	/* Generic DMA Control */
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci#define CNS3XXX_CORESIGHT_BASE			0x7A000000	/* CoreSight */
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci#define CNS3XXX_CRYPTO_BASE			0x7B000000	/* Crypto */
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci#define CNS3XXX_I2S_BASE			0x7C000000	/* I2S */
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci#define CNS3XXX_TIMER1_2_3_BASE			0x7C800000	/* Timer */
1158c2ecf20Sopenharmony_ci#define CNS3XXX_TIMER1_2_3_BASE_VIRT		0xFB003000
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci#define TIMER1_COUNTER_OFFSET			0x00
1188c2ecf20Sopenharmony_ci#define TIMER1_AUTO_RELOAD_OFFSET		0x04
1198c2ecf20Sopenharmony_ci#define TIMER1_MATCH_V1_OFFSET			0x08
1208c2ecf20Sopenharmony_ci#define TIMER1_MATCH_V2_OFFSET			0x0C
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci#define TIMER2_COUNTER_OFFSET			0x10
1238c2ecf20Sopenharmony_ci#define TIMER2_AUTO_RELOAD_OFFSET		0x14
1248c2ecf20Sopenharmony_ci#define TIMER2_MATCH_V1_OFFSET			0x18
1258c2ecf20Sopenharmony_ci#define TIMER2_MATCH_V2_OFFSET			0x1C
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci#define TIMER1_2_CONTROL_OFFSET			0x30
1288c2ecf20Sopenharmony_ci#define TIMER1_2_INTERRUPT_STATUS_OFFSET	0x34
1298c2ecf20Sopenharmony_ci#define TIMER1_2_INTERRUPT_MASK_OFFSET		0x38
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci#define TIMER_FREERUN_OFFSET			0x40
1328c2ecf20Sopenharmony_ci#define TIMER_FREERUN_CONTROL_OFFSET		0x44
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci#define CNS3XXX_HCIE_BASE			0x7D000000	/* HCIE Control */
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci#define CNS3XXX_RAID_BASE			0x7E000000	/* RAID Control */
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci#define CNS3XXX_AXI_IXC_BASE			0x7F000000	/* AXI IXC */
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci#define CNS3XXX_CLCD_BASE			0x80000000	/* LCD Control */
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci#define CNS3XXX_USBOTG_BASE			0x81000000	/* USB OTG Control */
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci#define CNS3XXX_USB_BASE			0x82000000	/* USB Host Control */
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci#define CNS3XXX_SATA2_BASE			0x83000000	/* SATA */
1478c2ecf20Sopenharmony_ci#define CNS3XXX_SATA2_SIZE			SZ_16M
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci#define CNS3XXX_CAMERA_BASE			0x84000000	/* Camera Interface */
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci#define CNS3XXX_SDIO_BASE			0x85000000	/* SDIO */
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci#define CNS3XXX_I2S_TDM_BASE			0x86000000	/* I2S TDM */
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci#define CNS3XXX_2DG_BASE			0x87000000	/* 2D Graphic Control */
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci#define CNS3XXX_USB_OHCI_BASE			0x88000000	/* USB OHCI */
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci#define CNS3XXX_L2C_BASE			0x92000000	/* L2 Cache Control */
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci#define CNS3XXX_PCIE0_MEM_BASE			0xA0000000	/* PCIe Port 0 IO/Memory Space */
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci#define CNS3XXX_PCIE0_HOST_BASE			0xAB000000	/* PCIe Port 0 RC Base */
1648c2ecf20Sopenharmony_ci#define CNS3XXX_PCIE0_HOST_BASE_VIRT		0xE1000000
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci#define CNS3XXX_PCIE0_IO_BASE			0xAC000000	/* PCIe Port 0 */
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci#define CNS3XXX_PCIE0_CFG0_BASE			0xAD000000	/* PCIe Port 0 CFG Type 0 */
1698c2ecf20Sopenharmony_ci#define CNS3XXX_PCIE0_CFG0_BASE_VIRT		0xE3000000
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci#define CNS3XXX_PCIE0_CFG1_BASE			0xAE000000	/* PCIe Port 0 CFG Type 1 */
1728c2ecf20Sopenharmony_ci#define CNS3XXX_PCIE0_CFG1_BASE_VIRT		0xE4000000
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci#define CNS3XXX_PCIE0_MSG_BASE			0xAF000000	/* PCIe Port 0 Message Space */
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ci#define CNS3XXX_PCIE1_MEM_BASE			0xB0000000	/* PCIe Port 1 IO/Memory Space */
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci#define CNS3XXX_PCIE1_HOST_BASE			0xBB000000	/* PCIe Port 1 RC Base */
1798c2ecf20Sopenharmony_ci#define CNS3XXX_PCIE1_HOST_BASE_VIRT		0xE9000000
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci#define CNS3XXX_PCIE1_IO_BASE			0xBC000000	/* PCIe Port 1 */
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci#define CNS3XXX_PCIE1_CFG0_BASE			0xBD000000	/* PCIe Port 1 CFG Type 0 */
1848c2ecf20Sopenharmony_ci#define CNS3XXX_PCIE1_CFG0_BASE_VIRT		0xEB000000
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci#define CNS3XXX_PCIE1_CFG1_BASE			0xBE000000	/* PCIe Port 1 CFG Type 1 */
1878c2ecf20Sopenharmony_ci#define CNS3XXX_PCIE1_CFG1_BASE_VIRT		0xEC000000
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci#define CNS3XXX_PCIE1_MSG_BASE			0xBF000000	/* PCIe Port 1 Message Space */
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci/*
1928c2ecf20Sopenharmony_ci * Testchip peripheral and fpga gic regions
1938c2ecf20Sopenharmony_ci */
1948c2ecf20Sopenharmony_ci#define CNS3XXX_TC11MP_SCU_BASE			0x90000000	/* IRQ, Test chip */
1958c2ecf20Sopenharmony_ci#define CNS3XXX_TC11MP_SCU_BASE_VIRT		0xFB004000
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ci#define CNS3XXX_TC11MP_GIC_CPU_BASE		0x90000100	/* Test chip interrupt controller CPU interface */
1988c2ecf20Sopenharmony_ci#define CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT	(CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x100)
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci#define CNS3XXX_TC11MP_TWD_BASE			0x90000600
2018c2ecf20Sopenharmony_ci#define CNS3XXX_TC11MP_TWD_BASE_VIRT		(CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x600)
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci#define CNS3XXX_TC11MP_GIC_DIST_BASE		0x90001000	/* Test chip interrupt controller distributor */
2048c2ecf20Sopenharmony_ci#define CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT	(CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x1000)
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci#define CNS3XXX_TC11MP_L220_BASE		0x92002000	/* L220 registers */
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci/*
2098c2ecf20Sopenharmony_ci * Misc block
2108c2ecf20Sopenharmony_ci */
2118c2ecf20Sopenharmony_ci#define MISC_MEM_MAP(offs) (void __iomem *)(CNS3XXX_MISC_BASE_VIRT + (offs))
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ci#define MISC_MEMORY_REMAP_REG			MISC_MEM_MAP(0x00)
2148c2ecf20Sopenharmony_ci#define MISC_CHIP_CONFIG_REG			MISC_MEM_MAP(0x04)
2158c2ecf20Sopenharmony_ci#define MISC_DEBUG_PROBE_DATA_REG		MISC_MEM_MAP(0x08)
2168c2ecf20Sopenharmony_ci#define MISC_DEBUG_PROBE_SELECTION_REG		MISC_MEM_MAP(0x0C)
2178c2ecf20Sopenharmony_ci#define MISC_IO_PIN_FUNC_SELECTION_REG		MISC_MEM_MAP(0x10)
2188c2ecf20Sopenharmony_ci#define MISC_GPIOA_PIN_ENABLE_REG		MISC_MEM_MAP(0x14)
2198c2ecf20Sopenharmony_ci#define MISC_GPIOB_PIN_ENABLE_REG		MISC_MEM_MAP(0x18)
2208c2ecf20Sopenharmony_ci#define MISC_IO_PAD_DRIVE_STRENGTH_CTRL_A	MISC_MEM_MAP(0x1C)
2218c2ecf20Sopenharmony_ci#define MISC_IO_PAD_DRIVE_STRENGTH_CTRL_B	MISC_MEM_MAP(0x20)
2228c2ecf20Sopenharmony_ci#define MISC_GPIOA_15_0_PULL_CTRL_REG		MISC_MEM_MAP(0x24)
2238c2ecf20Sopenharmony_ci#define MISC_GPIOA_16_31_PULL_CTRL_REG		MISC_MEM_MAP(0x28)
2248c2ecf20Sopenharmony_ci#define MISC_GPIOB_15_0_PULL_CTRL_REG		MISC_MEM_MAP(0x2C)
2258c2ecf20Sopenharmony_ci#define MISC_GPIOB_16_31_PULL_CTRL_REG		MISC_MEM_MAP(0x30)
2268c2ecf20Sopenharmony_ci#define MISC_IO_PULL_CTRL_REG			MISC_MEM_MAP(0x34)
2278c2ecf20Sopenharmony_ci#define MISC_E_FUSE_31_0_REG			MISC_MEM_MAP(0x40)
2288c2ecf20Sopenharmony_ci#define MISC_E_FUSE_63_32_REG			MISC_MEM_MAP(0x44)
2298c2ecf20Sopenharmony_ci#define MISC_E_FUSE_95_64_REG			MISC_MEM_MAP(0x48)
2308c2ecf20Sopenharmony_ci#define MISC_E_FUSE_127_96_REG			MISC_MEM_MAP(0x4C)
2318c2ecf20Sopenharmony_ci#define MISC_SOFTWARE_TEST_1_REG		MISC_MEM_MAP(0x50)
2328c2ecf20Sopenharmony_ci#define MISC_SOFTWARE_TEST_2_REG		MISC_MEM_MAP(0x54)
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci#define MISC_SATA_POWER_MODE			MISC_MEM_MAP(0x310)
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci#define MISC_USB_CFG_REG			MISC_MEM_MAP(0x800)
2378c2ecf20Sopenharmony_ci#define MISC_USB_STS_REG			MISC_MEM_MAP(0x804)
2388c2ecf20Sopenharmony_ci#define MISC_USBPHY00_CFG_REG			MISC_MEM_MAP(0x808)
2398c2ecf20Sopenharmony_ci#define MISC_USBPHY01_CFG_REG			MISC_MEM_MAP(0x80c)
2408c2ecf20Sopenharmony_ci#define MISC_USBPHY10_CFG_REG			MISC_MEM_MAP(0x810)
2418c2ecf20Sopenharmony_ci#define MISC_USBPHY11_CFG_REG			MISC_MEM_MAP(0x814)
2428c2ecf20Sopenharmony_ci
2438c2ecf20Sopenharmony_ci#define MISC_PCIEPHY_CMCTL(x)			MISC_MEM_MAP(0x900 + (x) * 0x004)
2448c2ecf20Sopenharmony_ci#define MISC_PCIEPHY_CTL(x)			MISC_MEM_MAP(0x940 + (x) * 0x100)
2458c2ecf20Sopenharmony_ci#define MISC_PCIE_AXIS_AWMISC(x)		MISC_MEM_MAP(0x944 + (x) * 0x100)
2468c2ecf20Sopenharmony_ci#define MISC_PCIE_AXIS_ARMISC(x)		MISC_MEM_MAP(0x948 + (x) * 0x100)
2478c2ecf20Sopenharmony_ci#define MISC_PCIE_AXIS_RMISC(x)			MISC_MEM_MAP(0x94C + (x) * 0x100)
2488c2ecf20Sopenharmony_ci#define MISC_PCIE_AXIS_BMISC(x)			MISC_MEM_MAP(0x950 + (x) * 0x100)
2498c2ecf20Sopenharmony_ci#define MISC_PCIE_AXIM_RMISC(x)			MISC_MEM_MAP(0x954 + (x) * 0x100)
2508c2ecf20Sopenharmony_ci#define MISC_PCIE_AXIM_BMISC(x)			MISC_MEM_MAP(0x958 + (x) * 0x100)
2518c2ecf20Sopenharmony_ci#define MISC_PCIE_CTRL(x)			MISC_MEM_MAP(0x95C + (x) * 0x100)
2528c2ecf20Sopenharmony_ci#define MISC_PCIE_PM_DEBUG(x)			MISC_MEM_MAP(0x960 + (x) * 0x100)
2538c2ecf20Sopenharmony_ci#define MISC_PCIE_RFC_DEBUG(x)			MISC_MEM_MAP(0x964 + (x) * 0x100)
2548c2ecf20Sopenharmony_ci#define MISC_PCIE_CXPL_DEBUGL(x)		MISC_MEM_MAP(0x968 + (x) * 0x100)
2558c2ecf20Sopenharmony_ci#define MISC_PCIE_CXPL_DEBUGH(x)		MISC_MEM_MAP(0x96C + (x) * 0x100)
2568c2ecf20Sopenharmony_ci#define MISC_PCIE_DIAG_DEBUGH(x)		MISC_MEM_MAP(0x970 + (x) * 0x100)
2578c2ecf20Sopenharmony_ci#define MISC_PCIE_W1CLR(x)			MISC_MEM_MAP(0x974 + (x) * 0x100)
2588c2ecf20Sopenharmony_ci#define MISC_PCIE_INT_MASK(x)			MISC_MEM_MAP(0x978 + (x) * 0x100)
2598c2ecf20Sopenharmony_ci#define MISC_PCIE_INT_STATUS(x)			MISC_MEM_MAP(0x97C + (x) * 0x100)
2608c2ecf20Sopenharmony_ci
2618c2ecf20Sopenharmony_ci/*
2628c2ecf20Sopenharmony_ci * Power management and clock control
2638c2ecf20Sopenharmony_ci */
2648c2ecf20Sopenharmony_ci#define PMU_MEM_MAP(offs) (void __iomem *)(CNS3XXX_PM_BASE_VIRT + (offs))
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG					PMU_MEM_MAP(0x000)
2678c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG					PMU_MEM_MAP(0x004)
2688c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG					PMU_MEM_MAP(0x008)
2698c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG				PMU_MEM_MAP(0x00C)
2708c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG					PMU_MEM_MAP(0x010)
2718c2ecf20Sopenharmony_ci#define PM_CLK_CTRL_REG					PMU_MEM_MAP(0x014)
2728c2ecf20Sopenharmony_ci#define PM_PLL_LCD_I2S_CTRL_REG				PMU_MEM_MAP(0x018)
2738c2ecf20Sopenharmony_ci#define PM_PLL_HM_PD_CTRL_REG				PMU_MEM_MAP(0x01C)
2748c2ecf20Sopenharmony_ci#define PM_REGULAT_CTRL_REG				PMU_MEM_MAP(0x020)
2758c2ecf20Sopenharmony_ci#define PM_WDT_CTRL_REG					PMU_MEM_MAP(0x024)
2768c2ecf20Sopenharmony_ci#define PM_WU_CTRL0_REG					PMU_MEM_MAP(0x028)
2778c2ecf20Sopenharmony_ci#define PM_WU_CTRL1_REG					PMU_MEM_MAP(0x02C)
2788c2ecf20Sopenharmony_ci#define PM_CSR_REG					PMU_MEM_MAP(0x030)
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ci/* PM_CLK_GATE_REG */
2818c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_SDIO			(25)
2828c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_GPU			(24)
2838c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_CIM			(23)
2848c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_LCDC			(22)
2858c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_I2S			(21)
2868c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_RAID			(20)
2878c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_SATA			(19)
2888c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_PCIE(x)			(17 + (x))
2898c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_USB_HOST			(16)
2908c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_USB_OTG			(15)
2918c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_TIMER			(14)
2928c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_CRYPTO			(13)
2938c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_HCIE			(12)
2948c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_SWITCH			(11)
2958c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_GPIO			(10)
2968c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_UART3			(9)
2978c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_UART2			(8)
2988c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_UART1			(7)
2998c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_RTC			(5)
3008c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_GDMA			(4)
3018c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_SPI_PCM_I2C		(3)
3028c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_OFFSET_SMC_NFI			(1)
3038c2ecf20Sopenharmony_ci#define PM_CLK_GATE_REG_MASK				(0x03FFFFBA)
3048c2ecf20Sopenharmony_ci
3058c2ecf20Sopenharmony_ci/* PM_SOFT_RST_REG */
3068c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_WARM_RST_FLAG		(31)
3078c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_CPU1			(29)
3088c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_CPU0			(28)
3098c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_SDIO			(25)
3108c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_GPU			(24)
3118c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_CIM			(23)
3128c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_LCDC			(22)
3138c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_I2S			(21)
3148c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_RAID			(20)
3158c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_SATA			(19)
3168c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_PCIE(x)			(17 + (x))
3178c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_USB_HOST			(16)
3188c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_USB_OTG			(15)
3198c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_TIMER			(14)
3208c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_CRYPTO			(13)
3218c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_HCIE			(12)
3228c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_SWITCH			(11)
3238c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_GPIO			(10)
3248c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_UART3			(9)
3258c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_UART2			(8)
3268c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_UART1			(7)
3278c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_RTC			(5)
3288c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_GDMA			(4)
3298c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_SPI_PCM_I2C		(3)
3308c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_DMC			(2)
3318c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_SMC_NFI			(1)
3328c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_OFFST_GLOBAL			(0)
3338c2ecf20Sopenharmony_ci#define PM_SOFT_RST_REG_MASK				(0xF3FFFFBF)
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci/* PMHS_CFG_REG */
3368c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_SDIO			(25)
3378c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_GPU			(24)
3388c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_CIM			(23)
3398c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_LCDC			(22)
3408c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_I2S			(21)
3418c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_RAID			(20)
3428c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_SATA			(19)
3438c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_PCIE1			(18)
3448c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_PCIE0			(17)
3458c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_USB_HOST			(16)
3468c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_USB_OTG			(15)
3478c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_TIMER			(14)
3488c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_CRYPTO			(13)
3498c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_HCIE			(12)
3508c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_SWITCH			(11)
3518c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_GPIO			(10)
3528c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_UART3			(9)
3538c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_UART2			(8)
3548c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_UART1			(7)
3558c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_RTC			(5)
3568c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_GDMA			(4)
3578c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_SPI_PCM_I2S		(3)
3588c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_DMC			(2)
3598c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_OFFSET_SMC_NFI			(1)
3608c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_MASK				(0x03FFFFBE)
3618c2ecf20Sopenharmony_ci#define PM_HS_CFG_REG_MASK_SUPPORT			(0x01100806)
3628c2ecf20Sopenharmony_ci
3638c2ecf20Sopenharmony_ci/* PM_CACTIVE_STA_REG */
3648c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_SDIO			(25)
3658c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_GPU			(24)
3668c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_CIM			(23)
3678c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_LCDC			(22)
3688c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_I2S			(21)
3698c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_RAID			(20)
3708c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_SATA			(19)
3718c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_PCIE1			(18)
3728c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_PCIE0			(17)
3738c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_USB_HOST		(16)
3748c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_USB_OTG		(15)
3758c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_TIMER			(14)
3768c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_CRYPTO		(13)
3778c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_HCIE			(12)
3788c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_SWITCH		(11)
3798c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_GPIO			(10)
3808c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_UART3			(9)
3818c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_UART2			(8)
3828c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_UART1			(7)
3838c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_RTC			(5)
3848c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_GDMA			(4)
3858c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_SPI_PCM_I2S		(3)
3868c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_DMC			(2)
3878c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_OFFSET_SMC_NFI		(1)
3888c2ecf20Sopenharmony_ci#define PM_CACTIVE_STA_REG_MASK				(0x03FFFFBE)
3898c2ecf20Sopenharmony_ci
3908c2ecf20Sopenharmony_ci/* PM_PWR_STA_REG */
3918c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_SDIO			(25)
3928c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_GPU			(24)
3938c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_CIM			(23)
3948c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_LCDC			(22)
3958c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_I2S			(21)
3968c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_RAID			(20)
3978c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_SATA			(19)
3988c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_PCIE1			(18)
3998c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_PCIE0			(17)
4008c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_USB_HOST		(16)
4018c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_USB_OTG		(15)
4028c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_TIMER			(14)
4038c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_CRYPTO		(13)
4048c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_HCIE			(12)
4058c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_SWITCH		(11)
4068c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_GPIO			(10)
4078c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_UART3			(9)
4088c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_UART2			(8)
4098c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_UART1			(7)
4108c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_RTC			(5)
4118c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_GDMA			(4)
4128c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_SPI_PCM_I2S		(3)
4138c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_DMC			(2)
4148c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_OFFSET_SMC_NFI		(1)
4158c2ecf20Sopenharmony_ci#define PM_PWR_STA_REG_REG_MASK				(0x03FFFFBE)
4168c2ecf20Sopenharmony_ci
4178c2ecf20Sopenharmony_ci/* PM_CLK_CTRL_REG */
4188c2ecf20Sopenharmony_ci#define PM_CLK_CTRL_REG_OFFSET_I2S_MCLK			(31)
4198c2ecf20Sopenharmony_ci#define PM_CLK_CTRL_REG_OFFSET_DDR2_CHG_EN		(30)
4208c2ecf20Sopenharmony_ci#define PM_CLK_CTRL_REG_OFFSET_PCIE_REF1_EN		(29)
4218c2ecf20Sopenharmony_ci#define PM_CLK_CTRL_REG_OFFSET_PCIE_REF0_EN		(28)
4228c2ecf20Sopenharmony_ci#define PM_CLK_CTRL_REG_OFFSET_TIMER_SIM_MODE		(27)
4238c2ecf20Sopenharmony_ci#define PM_CLK_CTRL_REG_OFFSET_I2SCLK_DIV		(24)
4248c2ecf20Sopenharmony_ci#define PM_CLK_CTRL_REG_OFFSET_I2SCLK_SEL		(22)
4258c2ecf20Sopenharmony_ci#define PM_CLK_CTRL_REG_OFFSET_CLKOUT_DIV		(20)
4268c2ecf20Sopenharmony_ci#define PM_CLK_CTRL_REG_OFFSET_CLKOUT_SEL		(16)
4278c2ecf20Sopenharmony_ci#define PM_CLK_CTRL_REG_OFFSET_MDC_DIV			(14)
4288c2ecf20Sopenharmony_ci#define PM_CLK_CTRL_REG_OFFSET_CRYPTO_CLK_SEL		(12)
4298c2ecf20Sopenharmony_ci#define PM_CLK_CTRL_REG_OFFSET_CPU_PWR_MODE		(9)
4308c2ecf20Sopenharmony_ci#define PM_CLK_CTRL_REG_OFFSET_PLL_DDR2_SEL		(7)
4318c2ecf20Sopenharmony_ci#define PM_CLK_CTRL_REG_OFFSET_DIV_IMMEDIATE		(6)
4328c2ecf20Sopenharmony_ci#define PM_CLK_CTRL_REG_OFFSET_CPU_CLK_DIV		(4)
4338c2ecf20Sopenharmony_ci#define PM_CLK_CTRL_REG_OFFSET_PLL_CPU_SEL		(0)
4348c2ecf20Sopenharmony_ci
4358c2ecf20Sopenharmony_ci#define PM_CPU_CLK_DIV(DIV) { \
4368c2ecf20Sopenharmony_ci	PM_CLK_CTRL_REG &= ~((0x3) << PM_CLK_CTRL_REG_OFFSET_CPU_CLK_DIV); \
4378c2ecf20Sopenharmony_ci	PM_CLK_CTRL_REG |= (((DIV)&0x3) << PM_CLK_CTRL_REG_OFFSET_CPU_CLK_DIV); \
4388c2ecf20Sopenharmony_ci}
4398c2ecf20Sopenharmony_ci
4408c2ecf20Sopenharmony_ci#define PM_PLL_CPU_SEL(CPU) { \
4418c2ecf20Sopenharmony_ci	PM_CLK_CTRL_REG &= ~((0xF) << PM_CLK_CTRL_REG_OFFSET_PLL_CPU_SEL); \
4428c2ecf20Sopenharmony_ci	PM_CLK_CTRL_REG |= (((CPU)&0xF) << PM_CLK_CTRL_REG_OFFSET_PLL_CPU_SEL); \
4438c2ecf20Sopenharmony_ci}
4448c2ecf20Sopenharmony_ci
4458c2ecf20Sopenharmony_ci/* PM_PLL_LCD_I2S_CTRL_REG */
4468c2ecf20Sopenharmony_ci#define PM_PLL_LCD_I2S_CTRL_REG_OFFSET_MCLK_SMC_DIV	(22)
4478c2ecf20Sopenharmony_ci#define PM_PLL_LCD_I2S_CTRL_REG_OFFSET_R_SEL		(17)
4488c2ecf20Sopenharmony_ci#define PM_PLL_LCD_I2S_CTRL_REG_OFFSET_PLL_LCD_P	(11)
4498c2ecf20Sopenharmony_ci#define PM_PLL_LCD_I2S_CTRL_REG_OFFSET_PLL_LCD_M	(3)
4508c2ecf20Sopenharmony_ci#define PM_PLL_LCD_I2S_CTRL_REG_OFFSET_PLL_LCD_S	(0)
4518c2ecf20Sopenharmony_ci
4528c2ecf20Sopenharmony_ci/* PM_PLL_HM_PD_CTRL_REG */
4538c2ecf20Sopenharmony_ci#define PM_PLL_HM_PD_CTRL_REG_OFFSET_SATA_PHY1		(11)
4548c2ecf20Sopenharmony_ci#define PM_PLL_HM_PD_CTRL_REG_OFFSET_SATA_PHY0		(10)
4558c2ecf20Sopenharmony_ci#define PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_I2SCD		(6)
4568c2ecf20Sopenharmony_ci#define PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_I2S		(5)
4578c2ecf20Sopenharmony_ci#define PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_LCD		(4)
4588c2ecf20Sopenharmony_ci#define PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_USB		(3)
4598c2ecf20Sopenharmony_ci#define PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_RGMII		(2)
4608c2ecf20Sopenharmony_ci#define PM_PLL_HM_PD_CTRL_REG_MASK			(0x00000C7C)
4618c2ecf20Sopenharmony_ci
4628c2ecf20Sopenharmony_ci/* PM_WDT_CTRL_REG */
4638c2ecf20Sopenharmony_ci#define PM_WDT_CTRL_REG_OFFSET_RESET_CPU_ONLY		(0)
4648c2ecf20Sopenharmony_ci
4658c2ecf20Sopenharmony_ci/* PM_CSR_REG - Clock Scaling Register*/
4668c2ecf20Sopenharmony_ci#define PM_CSR_REG_OFFSET_CSR_EN			(30)
4678c2ecf20Sopenharmony_ci#define PM_CSR_REG_OFFSET_CSR_NUM			(0)
4688c2ecf20Sopenharmony_ci
4698c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_CLK_EN(BLOCK) (0x1<<PM_CLK_GATE_REG_OFFSET_##BLOCK)
4708c2ecf20Sopenharmony_ci
4718c2ecf20Sopenharmony_ci/* Software reset*/
4728c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_SOFTWARE_RST(BLOCK) (0x1<<PM_SOFT_RST_REG_OFFST_##BLOCK)
4738c2ecf20Sopenharmony_ci
4748c2ecf20Sopenharmony_ci/*
4758c2ecf20Sopenharmony_ci * CNS3XXX support several power saving mode as following,
4768c2ecf20Sopenharmony_ci * DFS, IDLE, HALT, DOZE, SLEEP, Hibernate
4778c2ecf20Sopenharmony_ci */
4788c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_CPU_MODE_DFS			(0)
4798c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_CPU_MODE_IDLE			(1)
4808c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_CPU_MODE_HALT			(2)
4818c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_CPU_MODE_DOZE			(3)
4828c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_CPU_MODE_SLEEP			(4)
4838c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_CPU_MODE_HIBERNATE			(5)
4848c2ecf20Sopenharmony_ci
4858c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_PLL(BLOCK)	(0x1<<PM_PLL_HM_PD_CTRL_REG_OFFSET_##BLOCK)
4868c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_PLL_ALL	PM_PLL_HM_PD_CTRL_REG_MASK
4878c2ecf20Sopenharmony_ci
4888c2ecf20Sopenharmony_ci/* Change CPU frequency and divider */
4898c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_PLL_CPU_300MHZ			(0)
4908c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_PLL_CPU_333MHZ			(1)
4918c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_PLL_CPU_366MHZ			(2)
4928c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_PLL_CPU_400MHZ			(3)
4938c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_PLL_CPU_433MHZ			(4)
4948c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_PLL_CPU_466MHZ			(5)
4958c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_PLL_CPU_500MHZ			(6)
4968c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_PLL_CPU_533MHZ			(7)
4978c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_PLL_CPU_566MHZ			(8)
4988c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_PLL_CPU_600MHZ			(9)
4998c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_PLL_CPU_633MHZ			(10)
5008c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_PLL_CPU_666MHZ			(11)
5018c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_PLL_CPU_700MHZ			(12)
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_CPU_CLK_DIV_BY1			(0)
5048c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_CPU_CLK_DIV_BY2			(1)
5058c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_CPU_CLK_DIV_BY4			(2)
5068c2ecf20Sopenharmony_ci
5078c2ecf20Sopenharmony_ci/* Change DDR2 frequency */
5088c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_PLL_DDR2_200MHZ			(0)
5098c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_PLL_DDR2_266MHZ			(1)
5108c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_PLL_DDR2_333MHZ			(2)
5118c2ecf20Sopenharmony_ci#define CNS3XXX_PWR_PLL_DDR2_400MHZ			(3)
5128c2ecf20Sopenharmony_ci
5138c2ecf20Sopenharmony_civoid cns3xxx_pwr_soft_rst(unsigned int block);
5148c2ecf20Sopenharmony_civoid cns3xxx_pwr_clk_en(unsigned int block);
5158c2ecf20Sopenharmony_ciint cns3xxx_cpu_clock(void);
5168c2ecf20Sopenharmony_ci
5178c2ecf20Sopenharmony_ci/*
5188c2ecf20Sopenharmony_ci * ARM11 MPCore interrupt sources (primary GIC)
5198c2ecf20Sopenharmony_ci */
5208c2ecf20Sopenharmony_ci#define IRQ_TC11MP_GIC_START	32
5218c2ecf20Sopenharmony_ci
5228c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_PMU			(IRQ_TC11MP_GIC_START + 0)
5238c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_SDIO		(IRQ_TC11MP_GIC_START + 1)
5248c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_L2CC		(IRQ_TC11MP_GIC_START + 2)
5258c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_RTC			(IRQ_TC11MP_GIC_START + 3)
5268c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_I2S			(IRQ_TC11MP_GIC_START + 4)
5278c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_PCM			(IRQ_TC11MP_GIC_START + 5)
5288c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_SPI			(IRQ_TC11MP_GIC_START + 6)
5298c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_I2C			(IRQ_TC11MP_GIC_START + 7)
5308c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_CIM			(IRQ_TC11MP_GIC_START + 8)
5318c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_GPU			(IRQ_TC11MP_GIC_START + 9)
5328c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_LCD			(IRQ_TC11MP_GIC_START + 10)
5338c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_GPIOA		(IRQ_TC11MP_GIC_START + 11)
5348c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_GPIOB		(IRQ_TC11MP_GIC_START + 12)
5358c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_UART0		(IRQ_TC11MP_GIC_START + 13)
5368c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_UART1		(IRQ_TC11MP_GIC_START + 14)
5378c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_UART2		(IRQ_TC11MP_GIC_START + 15)
5388c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_ARM11		(IRQ_TC11MP_GIC_START + 16)
5398c2ecf20Sopenharmony_ci
5408c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_SW_STATUS		(IRQ_TC11MP_GIC_START + 17)
5418c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_SW_R0TXC		(IRQ_TC11MP_GIC_START + 18)
5428c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_SW_R0RXC		(IRQ_TC11MP_GIC_START + 19)
5438c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_SW_R0QE		(IRQ_TC11MP_GIC_START + 20)
5448c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_SW_R0QF		(IRQ_TC11MP_GIC_START + 21)
5458c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_SW_R1TXC		(IRQ_TC11MP_GIC_START + 22)
5468c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_SW_R1RXC		(IRQ_TC11MP_GIC_START + 23)
5478c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_SW_R1QE		(IRQ_TC11MP_GIC_START + 24)
5488c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_SW_R1QF		(IRQ_TC11MP_GIC_START + 25)
5498c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_SW_PPE		(IRQ_TC11MP_GIC_START + 26)
5508c2ecf20Sopenharmony_ci
5518c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_CRYPTO		(IRQ_TC11MP_GIC_START + 27)
5528c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_HCIE		(IRQ_TC11MP_GIC_START + 28)
5538c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_PCIE0_DEVICE	(IRQ_TC11MP_GIC_START + 29)
5548c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_PCIE1_DEVICE	(IRQ_TC11MP_GIC_START + 30)
5558c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_USB_OTG		(IRQ_TC11MP_GIC_START + 31)
5568c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_USB_EHCI		(IRQ_TC11MP_GIC_START + 32)
5578c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_SATA		(IRQ_TC11MP_GIC_START + 33)
5588c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_RAID		(IRQ_TC11MP_GIC_START + 34)
5598c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_SMC			(IRQ_TC11MP_GIC_START + 35)
5608c2ecf20Sopenharmony_ci
5618c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_DMAC_ABORT		(IRQ_TC11MP_GIC_START + 36)
5628c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_DMAC0		(IRQ_TC11MP_GIC_START + 37)
5638c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_DMAC1		(IRQ_TC11MP_GIC_START + 38)
5648c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_DMAC2		(IRQ_TC11MP_GIC_START + 39)
5658c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_DMAC3		(IRQ_TC11MP_GIC_START + 40)
5668c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_DMAC4		(IRQ_TC11MP_GIC_START + 41)
5678c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_DMAC5		(IRQ_TC11MP_GIC_START + 42)
5688c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_DMAC6		(IRQ_TC11MP_GIC_START + 43)
5698c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_DMAC7		(IRQ_TC11MP_GIC_START + 44)
5708c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_DMAC8		(IRQ_TC11MP_GIC_START + 45)
5718c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_DMAC9		(IRQ_TC11MP_GIC_START + 46)
5728c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_DMAC10		(IRQ_TC11MP_GIC_START + 47)
5738c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_DMAC11		(IRQ_TC11MP_GIC_START + 48)
5748c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_DMAC12		(IRQ_TC11MP_GIC_START + 49)
5758c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_DMAC13		(IRQ_TC11MP_GIC_START + 50)
5768c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_DMAC14		(IRQ_TC11MP_GIC_START + 51)
5778c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_DMAC15		(IRQ_TC11MP_GIC_START + 52)
5788c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_DMAC16		(IRQ_TC11MP_GIC_START + 53)
5798c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_DMAC17		(IRQ_TC11MP_GIC_START + 54)
5808c2ecf20Sopenharmony_ci
5818c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_PCIE0_RC		(IRQ_TC11MP_GIC_START + 55)
5828c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_PCIE1_RC		(IRQ_TC11MP_GIC_START + 56)
5838c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_TIMER0		(IRQ_TC11MP_GIC_START + 57)
5848c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_TIMER1		(IRQ_TC11MP_GIC_START + 58)
5858c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_USB_OHCI		(IRQ_TC11MP_GIC_START + 59)
5868c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_TIMER2		(IRQ_TC11MP_GIC_START + 60)
5878c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_EXTERNAL_PIN0	(IRQ_TC11MP_GIC_START + 61)
5888c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_EXTERNAL_PIN1	(IRQ_TC11MP_GIC_START + 62)
5898c2ecf20Sopenharmony_ci#define IRQ_CNS3XXX_EXTERNAL_PIN2	(IRQ_TC11MP_GIC_START + 63)
5908c2ecf20Sopenharmony_ci
5918c2ecf20Sopenharmony_ci#define NR_IRQS_CNS3XXX			(IRQ_TC11MP_GIC_START + 64)
5928c2ecf20Sopenharmony_ci
5938c2ecf20Sopenharmony_ci#endif	/* __MACH_BOARD_CNS3XXX_H */
594