162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Ralink RT3662/RT3883 SoC register definitions 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org> 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#ifndef _RT3883_REGS_H_ 962306a36Sopenharmony_ci#define _RT3883_REGS_H_ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#include <linux/bitops.h> 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#define IOMEM(x) ((void __iomem *)(KSEG1ADDR(x))) 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci#define RT3883_SDRAM_BASE 0x00000000 1662306a36Sopenharmony_ci#define RT3883_SYSC_BASE IOMEM(0x10000000) 1762306a36Sopenharmony_ci#define RT3883_TIMER_BASE 0x10000100 1862306a36Sopenharmony_ci#define RT3883_INTC_BASE 0x10000200 1962306a36Sopenharmony_ci#define RT3883_MEMC_BASE 0x10000300 2062306a36Sopenharmony_ci#define RT3883_UART0_BASE 0x10000500 2162306a36Sopenharmony_ci#define RT3883_PIO_BASE 0x10000600 2262306a36Sopenharmony_ci#define RT3883_FSCC_BASE 0x10000700 2362306a36Sopenharmony_ci#define RT3883_NANDC_BASE 0x10000810 2462306a36Sopenharmony_ci#define RT3883_I2C_BASE 0x10000900 2562306a36Sopenharmony_ci#define RT3883_I2S_BASE 0x10000a00 2662306a36Sopenharmony_ci#define RT3883_SPI_BASE 0x10000b00 2762306a36Sopenharmony_ci#define RT3883_UART1_BASE 0x10000c00 2862306a36Sopenharmony_ci#define RT3883_PCM_BASE 0x10002000 2962306a36Sopenharmony_ci#define RT3883_GDMA_BASE 0x10002800 3062306a36Sopenharmony_ci#define RT3883_CODEC1_BASE 0x10003000 3162306a36Sopenharmony_ci#define RT3883_CODEC2_BASE 0x10003800 3262306a36Sopenharmony_ci#define RT3883_FE_BASE 0x10100000 3362306a36Sopenharmony_ci#define RT3883_ROM_BASE 0x10118000 3462306a36Sopenharmony_ci#define RT3883_USBDEV_BASE 0x10112000 3562306a36Sopenharmony_ci#define RT3883_PCI_BASE 0x10140000 3662306a36Sopenharmony_ci#define RT3883_WLAN_BASE 0x10180000 3762306a36Sopenharmony_ci#define RT3883_USBHOST_BASE 0x101c0000 3862306a36Sopenharmony_ci#define RT3883_BOOT_BASE 0x1c000000 3962306a36Sopenharmony_ci#define RT3883_SRAM_BASE 0x1e000000 4062306a36Sopenharmony_ci#define RT3883_PCIMEM_BASE 0x20000000 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci#define RT3883_EHCI_BASE (RT3883_USBHOST_BASE) 4362306a36Sopenharmony_ci#define RT3883_OHCI_BASE (RT3883_USBHOST_BASE + 0x1000) 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci#define RT3883_SYSC_SIZE 0x100 4662306a36Sopenharmony_ci#define RT3883_TIMER_SIZE 0x100 4762306a36Sopenharmony_ci#define RT3883_INTC_SIZE 0x100 4862306a36Sopenharmony_ci#define RT3883_MEMC_SIZE 0x100 4962306a36Sopenharmony_ci#define RT3883_UART0_SIZE 0x100 5062306a36Sopenharmony_ci#define RT3883_UART1_SIZE 0x100 5162306a36Sopenharmony_ci#define RT3883_PIO_SIZE 0x100 5262306a36Sopenharmony_ci#define RT3883_FSCC_SIZE 0x100 5362306a36Sopenharmony_ci#define RT3883_NANDC_SIZE 0x0f0 5462306a36Sopenharmony_ci#define RT3883_I2C_SIZE 0x100 5562306a36Sopenharmony_ci#define RT3883_I2S_SIZE 0x100 5662306a36Sopenharmony_ci#define RT3883_SPI_SIZE 0x100 5762306a36Sopenharmony_ci#define RT3883_PCM_SIZE 0x800 5862306a36Sopenharmony_ci#define RT3883_GDMA_SIZE 0x800 5962306a36Sopenharmony_ci#define RT3883_CODEC1_SIZE 0x800 6062306a36Sopenharmony_ci#define RT3883_CODEC2_SIZE 0x800 6162306a36Sopenharmony_ci#define RT3883_FE_SIZE 0x10000 6262306a36Sopenharmony_ci#define RT3883_ROM_SIZE 0x4000 6362306a36Sopenharmony_ci#define RT3883_USBDEV_SIZE 0x4000 6462306a36Sopenharmony_ci#define RT3883_PCI_SIZE 0x40000 6562306a36Sopenharmony_ci#define RT3883_WLAN_SIZE 0x40000 6662306a36Sopenharmony_ci#define RT3883_USBHOST_SIZE 0x40000 6762306a36Sopenharmony_ci#define RT3883_BOOT_SIZE (32 * 1024 * 1024) 6862306a36Sopenharmony_ci#define RT3883_SRAM_SIZE (32 * 1024 * 1024) 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci/* SYSC registers */ 7162306a36Sopenharmony_ci#define RT3883_SYSC_REG_CHIPID0_3 0x00 /* Chip ID 0 */ 7262306a36Sopenharmony_ci#define RT3883_SYSC_REG_CHIPID4_7 0x04 /* Chip ID 1 */ 7362306a36Sopenharmony_ci#define RT3883_SYSC_REG_REVID 0x0c /* Chip Revision Identification */ 7462306a36Sopenharmony_ci#define RT3883_SYSC_REG_SYSCFG0 0x10 /* System Configuration 0 */ 7562306a36Sopenharmony_ci#define RT3883_SYSC_REG_SYSCFG1 0x14 /* System Configuration 1 */ 7662306a36Sopenharmony_ci#define RT3883_SYSC_REG_CLKCFG0 0x2c /* Clock Configuration 0 */ 7762306a36Sopenharmony_ci#define RT3883_SYSC_REG_CLKCFG1 0x30 /* Clock Configuration 1 */ 7862306a36Sopenharmony_ci#define RT3883_SYSC_REG_RSTCTRL 0x34 /* Reset Control*/ 7962306a36Sopenharmony_ci#define RT3883_SYSC_REG_RSTSTAT 0x38 /* Reset Status*/ 8062306a36Sopenharmony_ci#define RT3883_SYSC_REG_USB_PS 0x5c /* USB Power saving control */ 8162306a36Sopenharmony_ci#define RT3883_SYSC_REG_GPIO_MODE 0x60 /* GPIO Purpose Select */ 8262306a36Sopenharmony_ci#define RT3883_SYSC_REG_PCIE_CLK_GEN0 0x7c 8362306a36Sopenharmony_ci#define RT3883_SYSC_REG_PCIE_CLK_GEN1 0x80 8462306a36Sopenharmony_ci#define RT3883_SYSC_REG_PCIE_CLK_GEN2 0x84 8562306a36Sopenharmony_ci#define RT3883_SYSC_REG_PMU 0x88 8662306a36Sopenharmony_ci#define RT3883_SYSC_REG_PMU1 0x8c 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci#define RT3883_CHIP_NAME0 0x38335452 8962306a36Sopenharmony_ci#define RT3883_CHIP_NAME1 0x20203338 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ci#define RT3883_REVID_VER_ID_MASK 0x0f 9262306a36Sopenharmony_ci#define RT3883_REVID_VER_ID_SHIFT 8 9362306a36Sopenharmony_ci#define RT3883_REVID_ECO_ID_MASK 0x0f 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ci#define RT3883_SYSCFG1_USB0_HOST_MODE BIT(10) 9662306a36Sopenharmony_ci#define RT3883_SYSCFG1_PCIE_RC_MODE BIT(8) 9762306a36Sopenharmony_ci#define RT3883_SYSCFG1_PCI_HOST_MODE BIT(7) 9862306a36Sopenharmony_ci#define RT3883_SYSCFG1_PCI_66M_MODE BIT(6) 9962306a36Sopenharmony_ci#define RT3883_SYSCFG1_GPIO2_AS_WDT_OUT BIT(2) 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci#define RT3883_CLKCFG1_PCIE_CLK_EN BIT(21) 10262306a36Sopenharmony_ci#define RT3883_CLKCFG1_UPHY1_CLK_EN BIT(20) 10362306a36Sopenharmony_ci#define RT3883_CLKCFG1_PCI_CLK_EN BIT(19) 10462306a36Sopenharmony_ci#define RT3883_CLKCFG1_UPHY0_CLK_EN BIT(18) 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ci#define RT3883_GPIO_I2C_SD 1 10762306a36Sopenharmony_ci#define RT3883_GPIO_I2C_SCLK 2 10862306a36Sopenharmony_ci#define RT3883_GPIO_SPI_CS0 3 10962306a36Sopenharmony_ci#define RT3883_GPIO_SPI_CLK 4 11062306a36Sopenharmony_ci#define RT3883_GPIO_SPI_MOSI 5 11162306a36Sopenharmony_ci#define RT3883_GPIO_SPI_MISO 6 11262306a36Sopenharmony_ci#define RT3883_GPIO_7 7 11362306a36Sopenharmony_ci#define RT3883_GPIO_10 10 11462306a36Sopenharmony_ci#define RT3883_GPIO_11 11 11562306a36Sopenharmony_ci#define RT3883_GPIO_14 14 11662306a36Sopenharmony_ci#define RT3883_GPIO_UART1_TXD 15 11762306a36Sopenharmony_ci#define RT3883_GPIO_UART1_RXD 16 11862306a36Sopenharmony_ci#define RT3883_GPIO_JTAG_TDO 17 11962306a36Sopenharmony_ci#define RT3883_GPIO_JTAG_TDI 18 12062306a36Sopenharmony_ci#define RT3883_GPIO_JTAG_TMS 19 12162306a36Sopenharmony_ci#define RT3883_GPIO_JTAG_TCLK 20 12262306a36Sopenharmony_ci#define RT3883_GPIO_JTAG_TRST_N 21 12362306a36Sopenharmony_ci#define RT3883_GPIO_MDIO_MDC 22 12462306a36Sopenharmony_ci#define RT3883_GPIO_MDIO_MDIO 23 12562306a36Sopenharmony_ci#define RT3883_GPIO_LNA_PE_A0 32 12662306a36Sopenharmony_ci#define RT3883_GPIO_LNA_PE_A1 33 12762306a36Sopenharmony_ci#define RT3883_GPIO_LNA_PE_A2 34 12862306a36Sopenharmony_ci#define RT3883_GPIO_LNA_PE_G0 35 12962306a36Sopenharmony_ci#define RT3883_GPIO_LNA_PE_G1 36 13062306a36Sopenharmony_ci#define RT3883_GPIO_LNA_PE_G2 37 13162306a36Sopenharmony_ci#define RT3883_GPIO_PCI_AD0 40 13262306a36Sopenharmony_ci#define RT3883_GPIO_PCI_AD31 71 13362306a36Sopenharmony_ci#define RT3883_GPIO_GE2_TXD0 72 13462306a36Sopenharmony_ci#define RT3883_GPIO_GE2_TXD1 73 13562306a36Sopenharmony_ci#define RT3883_GPIO_GE2_TXD2 74 13662306a36Sopenharmony_ci#define RT3883_GPIO_GE2_TXD3 75 13762306a36Sopenharmony_ci#define RT3883_GPIO_GE2_TXEN 76 13862306a36Sopenharmony_ci#define RT3883_GPIO_GE2_TXCLK 77 13962306a36Sopenharmony_ci#define RT3883_GPIO_GE2_RXD0 78 14062306a36Sopenharmony_ci#define RT3883_GPIO_GE2_RXD1 79 14162306a36Sopenharmony_ci#define RT3883_GPIO_GE2_RXD2 80 14262306a36Sopenharmony_ci#define RT3883_GPIO_GE2_RXD3 81 14362306a36Sopenharmony_ci#define RT3883_GPIO_GE2_RXDV 82 14462306a36Sopenharmony_ci#define RT3883_GPIO_GE2_RXCLK 83 14562306a36Sopenharmony_ci#define RT3883_GPIO_GE1_TXD0 84 14662306a36Sopenharmony_ci#define RT3883_GPIO_GE1_TXD1 85 14762306a36Sopenharmony_ci#define RT3883_GPIO_GE1_TXD2 86 14862306a36Sopenharmony_ci#define RT3883_GPIO_GE1_TXD3 87 14962306a36Sopenharmony_ci#define RT3883_GPIO_GE1_TXEN 88 15062306a36Sopenharmony_ci#define RT3883_GPIO_GE1_TXCLK 89 15162306a36Sopenharmony_ci#define RT3883_GPIO_GE1_RXD0 90 15262306a36Sopenharmony_ci#define RT3883_GPIO_GE1_RXD1 91 15362306a36Sopenharmony_ci#define RT3883_GPIO_GE1_RXD2 92 15462306a36Sopenharmony_ci#define RT3883_GPIO_GE1_RXD3 93 15562306a36Sopenharmony_ci#define RT3883_GPIO_GE1_RXDV 94 15662306a36Sopenharmony_ci#define RT3883_GPIO_GE1_RXCLK 95 15762306a36Sopenharmony_ci 15862306a36Sopenharmony_ci#define RT3883_RSTCTRL_PCIE_PCI_PDM BIT(27) 15962306a36Sopenharmony_ci#define RT3883_RSTCTRL_FLASH BIT(26) 16062306a36Sopenharmony_ci#define RT3883_RSTCTRL_UDEV BIT(25) 16162306a36Sopenharmony_ci#define RT3883_RSTCTRL_PCI BIT(24) 16262306a36Sopenharmony_ci#define RT3883_RSTCTRL_PCIE BIT(23) 16362306a36Sopenharmony_ci#define RT3883_RSTCTRL_UHST BIT(22) 16462306a36Sopenharmony_ci#define RT3883_RSTCTRL_FE BIT(21) 16562306a36Sopenharmony_ci#define RT3883_RSTCTRL_WLAN BIT(20) 16662306a36Sopenharmony_ci#define RT3883_RSTCTRL_UART1 BIT(29) 16762306a36Sopenharmony_ci#define RT3883_RSTCTRL_SPI BIT(18) 16862306a36Sopenharmony_ci#define RT3883_RSTCTRL_I2S BIT(17) 16962306a36Sopenharmony_ci#define RT3883_RSTCTRL_I2C BIT(16) 17062306a36Sopenharmony_ci#define RT3883_RSTCTRL_NAND BIT(15) 17162306a36Sopenharmony_ci#define RT3883_RSTCTRL_DMA BIT(14) 17262306a36Sopenharmony_ci#define RT3883_RSTCTRL_PIO BIT(13) 17362306a36Sopenharmony_ci#define RT3883_RSTCTRL_UART BIT(12) 17462306a36Sopenharmony_ci#define RT3883_RSTCTRL_PCM BIT(11) 17562306a36Sopenharmony_ci#define RT3883_RSTCTRL_MC BIT(10) 17662306a36Sopenharmony_ci#define RT3883_RSTCTRL_INTC BIT(9) 17762306a36Sopenharmony_ci#define RT3883_RSTCTRL_TIMER BIT(8) 17862306a36Sopenharmony_ci#define RT3883_RSTCTRL_SYS BIT(0) 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_ci#define RT3883_INTC_INT_SYSCTL BIT(0) 18162306a36Sopenharmony_ci#define RT3883_INTC_INT_TIMER0 BIT(1) 18262306a36Sopenharmony_ci#define RT3883_INTC_INT_TIMER1 BIT(2) 18362306a36Sopenharmony_ci#define RT3883_INTC_INT_IA BIT(3) 18462306a36Sopenharmony_ci#define RT3883_INTC_INT_PCM BIT(4) 18562306a36Sopenharmony_ci#define RT3883_INTC_INT_UART0 BIT(5) 18662306a36Sopenharmony_ci#define RT3883_INTC_INT_PIO BIT(6) 18762306a36Sopenharmony_ci#define RT3883_INTC_INT_DMA BIT(7) 18862306a36Sopenharmony_ci#define RT3883_INTC_INT_NAND BIT(8) 18962306a36Sopenharmony_ci#define RT3883_INTC_INT_PERFC BIT(9) 19062306a36Sopenharmony_ci#define RT3883_INTC_INT_I2S BIT(10) 19162306a36Sopenharmony_ci#define RT3883_INTC_INT_UART1 BIT(12) 19262306a36Sopenharmony_ci#define RT3883_INTC_INT_UHST BIT(18) 19362306a36Sopenharmony_ci#define RT3883_INTC_INT_UDEV BIT(19) 19462306a36Sopenharmony_ci 19562306a36Sopenharmony_ci/* FLASH/SRAM/Codec Controller registers */ 19662306a36Sopenharmony_ci#define RT3883_FSCC_REG_FLASH_CFG0 0x00 19762306a36Sopenharmony_ci#define RT3883_FSCC_REG_FLASH_CFG1 0x04 19862306a36Sopenharmony_ci#define RT3883_FSCC_REG_CODEC_CFG0 0x40 19962306a36Sopenharmony_ci#define RT3883_FSCC_REG_CODEC_CFG1 0x44 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ci#define RT3883_FLASH_CFG_WIDTH_SHIFT 26 20262306a36Sopenharmony_ci#define RT3883_FLASH_CFG_WIDTH_MASK 0x3 20362306a36Sopenharmony_ci#define RT3883_FLASH_CFG_WIDTH_8BIT 0x0 20462306a36Sopenharmony_ci#define RT3883_FLASH_CFG_WIDTH_16BIT 0x1 20562306a36Sopenharmony_ci#define RT3883_FLASH_CFG_WIDTH_32BIT 0x2 20662306a36Sopenharmony_ci 20762306a36Sopenharmony_ci#define RT3883_SDRAM_BASE 0x00000000 20862306a36Sopenharmony_ci#define RT3883_MEM_SIZE_MIN 2 20962306a36Sopenharmony_ci#define RT3883_MEM_SIZE_MAX 256 21062306a36Sopenharmony_ci 21162306a36Sopenharmony_ci#endif /* _RT3883_REGS_H_ */ 212