1*d4a67d9dSGabor Juhos /* 2*d4a67d9dSGabor Juhos * Atheros AR71XX/AR724X/AR913X SoC register definitions 3*d4a67d9dSGabor Juhos * 4*d4a67d9dSGabor Juhos * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org> 5*d4a67d9dSGabor Juhos * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> 6*d4a67d9dSGabor Juhos * 7*d4a67d9dSGabor Juhos * Parts of this file are based on Atheros' 2.6.15 BSP 8*d4a67d9dSGabor Juhos * 9*d4a67d9dSGabor Juhos * This program is free software; you can redistribute it and/or modify it 10*d4a67d9dSGabor Juhos * under the terms of the GNU General Public License version 2 as published 11*d4a67d9dSGabor Juhos * by the Free Software Foundation. 12*d4a67d9dSGabor Juhos */ 13*d4a67d9dSGabor Juhos 14*d4a67d9dSGabor Juhos #ifndef __ASM_MACH_AR71XX_REGS_H 15*d4a67d9dSGabor Juhos #define __ASM_MACH_AR71XX_REGS_H 16*d4a67d9dSGabor Juhos 17*d4a67d9dSGabor Juhos #include <linux/types.h> 18*d4a67d9dSGabor Juhos #include <linux/init.h> 19*d4a67d9dSGabor Juhos #include <linux/io.h> 20*d4a67d9dSGabor Juhos #include <linux/bitops.h> 21*d4a67d9dSGabor Juhos 22*d4a67d9dSGabor Juhos #define AR71XX_APB_BASE 0x18000000 23*d4a67d9dSGabor Juhos 24*d4a67d9dSGabor Juhos #define AR71XX_DDR_CTRL_BASE (AR71XX_APB_BASE + 0x00000000) 25*d4a67d9dSGabor Juhos #define AR71XX_DDR_CTRL_SIZE 0x100 26*d4a67d9dSGabor Juhos #define AR71XX_UART_BASE (AR71XX_APB_BASE + 0x00020000) 27*d4a67d9dSGabor Juhos #define AR71XX_UART_SIZE 0x100 28*d4a67d9dSGabor Juhos #define AR71XX_PLL_BASE (AR71XX_APB_BASE + 0x00050000) 29*d4a67d9dSGabor Juhos #define AR71XX_PLL_SIZE 0x100 30*d4a67d9dSGabor Juhos #define AR71XX_RESET_BASE (AR71XX_APB_BASE + 0x00060000) 31*d4a67d9dSGabor Juhos #define AR71XX_RESET_SIZE 0x100 32*d4a67d9dSGabor Juhos 33*d4a67d9dSGabor Juhos /* 34*d4a67d9dSGabor Juhos * DDR_CTRL block 35*d4a67d9dSGabor Juhos */ 36*d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN0 0x7c 37*d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN1 0x80 38*d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN2 0x84 39*d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN3 0x88 40*d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN4 0x8c 41*d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN5 0x90 42*d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN6 0x94 43*d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_PCI_WIN7 0x98 44*d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_FLUSH_GE0 0x9c 45*d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_FLUSH_GE1 0xa0 46*d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_FLUSH_USB 0xa4 47*d4a67d9dSGabor Juhos #define AR71XX_DDR_REG_FLUSH_PCI 0xa8 48*d4a67d9dSGabor Juhos 49*d4a67d9dSGabor Juhos #define AR724X_DDR_REG_FLUSH_GE0 0x7c 50*d4a67d9dSGabor Juhos #define AR724X_DDR_REG_FLUSH_GE1 0x80 51*d4a67d9dSGabor Juhos #define AR724X_DDR_REG_FLUSH_USB 0x84 52*d4a67d9dSGabor Juhos #define AR724X_DDR_REG_FLUSH_PCIE 0x88 53*d4a67d9dSGabor Juhos 54*d4a67d9dSGabor Juhos #define AR913X_DDR_REG_FLUSH_GE0 0x7c 55*d4a67d9dSGabor Juhos #define AR913X_DDR_REG_FLUSH_GE1 0x80 56*d4a67d9dSGabor Juhos #define AR913X_DDR_REG_FLUSH_USB 0x84 57*d4a67d9dSGabor Juhos #define AR913X_DDR_REG_FLUSH_WMAC 0x88 58*d4a67d9dSGabor Juhos 59*d4a67d9dSGabor Juhos /* 60*d4a67d9dSGabor Juhos * PLL block 61*d4a67d9dSGabor Juhos */ 62*d4a67d9dSGabor Juhos #define AR71XX_PLL_REG_CPU_CONFIG 0x00 63*d4a67d9dSGabor Juhos #define AR71XX_PLL_REG_SEC_CONFIG 0x04 64*d4a67d9dSGabor Juhos #define AR71XX_PLL_REG_ETH0_INT_CLOCK 0x10 65*d4a67d9dSGabor Juhos #define AR71XX_PLL_REG_ETH1_INT_CLOCK 0x14 66*d4a67d9dSGabor Juhos 67*d4a67d9dSGabor Juhos #define AR71XX_PLL_DIV_SHIFT 3 68*d4a67d9dSGabor Juhos #define AR71XX_PLL_DIV_MASK 0x1f 69*d4a67d9dSGabor Juhos #define AR71XX_CPU_DIV_SHIFT 16 70*d4a67d9dSGabor Juhos #define AR71XX_CPU_DIV_MASK 0x3 71*d4a67d9dSGabor Juhos #define AR71XX_DDR_DIV_SHIFT 18 72*d4a67d9dSGabor Juhos #define AR71XX_DDR_DIV_MASK 0x3 73*d4a67d9dSGabor Juhos #define AR71XX_AHB_DIV_SHIFT 20 74*d4a67d9dSGabor Juhos #define AR71XX_AHB_DIV_MASK 0x7 75*d4a67d9dSGabor Juhos 76*d4a67d9dSGabor Juhos #define AR724X_PLL_REG_CPU_CONFIG 0x00 77*d4a67d9dSGabor Juhos #define AR724X_PLL_REG_PCIE_CONFIG 0x18 78*d4a67d9dSGabor Juhos 79*d4a67d9dSGabor Juhos #define AR724X_PLL_DIV_SHIFT 0 80*d4a67d9dSGabor Juhos #define AR724X_PLL_DIV_MASK 0x3ff 81*d4a67d9dSGabor Juhos #define AR724X_PLL_REF_DIV_SHIFT 10 82*d4a67d9dSGabor Juhos #define AR724X_PLL_REF_DIV_MASK 0xf 83*d4a67d9dSGabor Juhos #define AR724X_AHB_DIV_SHIFT 19 84*d4a67d9dSGabor Juhos #define AR724X_AHB_DIV_MASK 0x1 85*d4a67d9dSGabor Juhos #define AR724X_DDR_DIV_SHIFT 22 86*d4a67d9dSGabor Juhos #define AR724X_DDR_DIV_MASK 0x3 87*d4a67d9dSGabor Juhos 88*d4a67d9dSGabor Juhos #define AR913X_PLL_REG_CPU_CONFIG 0x00 89*d4a67d9dSGabor Juhos #define AR913X_PLL_REG_ETH_CONFIG 0x04 90*d4a67d9dSGabor Juhos #define AR913X_PLL_REG_ETH0_INT_CLOCK 0x14 91*d4a67d9dSGabor Juhos #define AR913X_PLL_REG_ETH1_INT_CLOCK 0x18 92*d4a67d9dSGabor Juhos 93*d4a67d9dSGabor Juhos #define AR913X_PLL_DIV_SHIFT 0 94*d4a67d9dSGabor Juhos #define AR913X_PLL_DIV_MASK 0x3ff 95*d4a67d9dSGabor Juhos #define AR913X_DDR_DIV_SHIFT 22 96*d4a67d9dSGabor Juhos #define AR913X_DDR_DIV_MASK 0x3 97*d4a67d9dSGabor Juhos #define AR913X_AHB_DIV_SHIFT 19 98*d4a67d9dSGabor Juhos #define AR913X_AHB_DIV_MASK 0x1 99*d4a67d9dSGabor Juhos 100*d4a67d9dSGabor Juhos /* 101*d4a67d9dSGabor Juhos * RESET block 102*d4a67d9dSGabor Juhos */ 103*d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_TIMER 0x00 104*d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_TIMER_RELOAD 0x04 105*d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_WDOG_CTRL 0x08 106*d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_WDOG 0x0c 107*d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_MISC_INT_STATUS 0x10 108*d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_MISC_INT_ENABLE 0x14 109*d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_PCI_INT_STATUS 0x18 110*d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_PCI_INT_ENABLE 0x1c 111*d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_GLOBAL_INT_STATUS 0x20 112*d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_RESET_MODULE 0x24 113*d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_PERFC_CTRL 0x2c 114*d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_PERFC0 0x30 115*d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_PERFC1 0x34 116*d4a67d9dSGabor Juhos #define AR71XX_RESET_REG_REV_ID 0x90 117*d4a67d9dSGabor Juhos 118*d4a67d9dSGabor Juhos #define AR913X_RESET_REG_GLOBAL_INT_STATUS 0x18 119*d4a67d9dSGabor Juhos #define AR913X_RESET_REG_RESET_MODULE 0x1c 120*d4a67d9dSGabor Juhos #define AR913X_RESET_REG_PERF_CTRL 0x20 121*d4a67d9dSGabor Juhos #define AR913X_RESET_REG_PERFC0 0x24 122*d4a67d9dSGabor Juhos #define AR913X_RESET_REG_PERFC1 0x28 123*d4a67d9dSGabor Juhos 124*d4a67d9dSGabor Juhos #define AR724X_RESET_REG_RESET_MODULE 0x1c 125*d4a67d9dSGabor Juhos 126*d4a67d9dSGabor Juhos #define MISC_INT_DMA BIT(7) 127*d4a67d9dSGabor Juhos #define MISC_INT_OHCI BIT(6) 128*d4a67d9dSGabor Juhos #define MISC_INT_PERFC BIT(5) 129*d4a67d9dSGabor Juhos #define MISC_INT_WDOG BIT(4) 130*d4a67d9dSGabor Juhos #define MISC_INT_UART BIT(3) 131*d4a67d9dSGabor Juhos #define MISC_INT_GPIO BIT(2) 132*d4a67d9dSGabor Juhos #define MISC_INT_ERROR BIT(1) 133*d4a67d9dSGabor Juhos #define MISC_INT_TIMER BIT(0) 134*d4a67d9dSGabor Juhos 135*d4a67d9dSGabor Juhos #define AR71XX_RESET_EXTERNAL BIT(28) 136*d4a67d9dSGabor Juhos #define AR71XX_RESET_FULL_CHIP BIT(24) 137*d4a67d9dSGabor Juhos #define AR71XX_RESET_CPU_NMI BIT(21) 138*d4a67d9dSGabor Juhos #define AR71XX_RESET_CPU_COLD BIT(20) 139*d4a67d9dSGabor Juhos #define AR71XX_RESET_DMA BIT(19) 140*d4a67d9dSGabor Juhos #define AR71XX_RESET_SLIC BIT(18) 141*d4a67d9dSGabor Juhos #define AR71XX_RESET_STEREO BIT(17) 142*d4a67d9dSGabor Juhos #define AR71XX_RESET_DDR BIT(16) 143*d4a67d9dSGabor Juhos #define AR71XX_RESET_GE1_MAC BIT(13) 144*d4a67d9dSGabor Juhos #define AR71XX_RESET_GE1_PHY BIT(12) 145*d4a67d9dSGabor Juhos #define AR71XX_RESET_USBSUS_OVERRIDE BIT(10) 146*d4a67d9dSGabor Juhos #define AR71XX_RESET_GE0_MAC BIT(9) 147*d4a67d9dSGabor Juhos #define AR71XX_RESET_GE0_PHY BIT(8) 148*d4a67d9dSGabor Juhos #define AR71XX_RESET_USB_OHCI_DLL BIT(6) 149*d4a67d9dSGabor Juhos #define AR71XX_RESET_USB_HOST BIT(5) 150*d4a67d9dSGabor Juhos #define AR71XX_RESET_USB_PHY BIT(4) 151*d4a67d9dSGabor Juhos #define AR71XX_RESET_PCI_BUS BIT(1) 152*d4a67d9dSGabor Juhos #define AR71XX_RESET_PCI_CORE BIT(0) 153*d4a67d9dSGabor Juhos 154*d4a67d9dSGabor Juhos #define AR724X_RESET_GE1_MDIO BIT(23) 155*d4a67d9dSGabor Juhos #define AR724X_RESET_GE0_MDIO BIT(22) 156*d4a67d9dSGabor Juhos #define AR724X_RESET_PCIE_PHY_SERIAL BIT(10) 157*d4a67d9dSGabor Juhos #define AR724X_RESET_PCIE_PHY BIT(7) 158*d4a67d9dSGabor Juhos #define AR724X_RESET_PCIE BIT(6) 159*d4a67d9dSGabor Juhos #define AR724X_RESET_OHCI_DLL BIT(3) 160*d4a67d9dSGabor Juhos 161*d4a67d9dSGabor Juhos #define AR913X_RESET_AMBA2WMAC BIT(22) 162*d4a67d9dSGabor Juhos 163*d4a67d9dSGabor Juhos #define REV_ID_MAJOR_MASK 0xfff0 164*d4a67d9dSGabor Juhos #define REV_ID_MAJOR_AR71XX 0x00a0 165*d4a67d9dSGabor Juhos #define REV_ID_MAJOR_AR913X 0x00b0 166*d4a67d9dSGabor Juhos #define REV_ID_MAJOR_AR7240 0x00c0 167*d4a67d9dSGabor Juhos #define REV_ID_MAJOR_AR7241 0x0100 168*d4a67d9dSGabor Juhos #define REV_ID_MAJOR_AR7242 0x1100 169*d4a67d9dSGabor Juhos 170*d4a67d9dSGabor Juhos #define AR71XX_REV_ID_MINOR_MASK 0x3 171*d4a67d9dSGabor Juhos #define AR71XX_REV_ID_MINOR_AR7130 0x0 172*d4a67d9dSGabor Juhos #define AR71XX_REV_ID_MINOR_AR7141 0x1 173*d4a67d9dSGabor Juhos #define AR71XX_REV_ID_MINOR_AR7161 0x2 174*d4a67d9dSGabor Juhos #define AR71XX_REV_ID_REVISION_MASK 0x3 175*d4a67d9dSGabor Juhos #define AR71XX_REV_ID_REVISION_SHIFT 2 176*d4a67d9dSGabor Juhos 177*d4a67d9dSGabor Juhos #define AR913X_REV_ID_MINOR_MASK 0x3 178*d4a67d9dSGabor Juhos #define AR913X_REV_ID_MINOR_AR9130 0x0 179*d4a67d9dSGabor Juhos #define AR913X_REV_ID_MINOR_AR9132 0x1 180*d4a67d9dSGabor Juhos #define AR913X_REV_ID_REVISION_MASK 0x3 181*d4a67d9dSGabor Juhos #define AR913X_REV_ID_REVISION_SHIFT 2 182*d4a67d9dSGabor Juhos 183*d4a67d9dSGabor Juhos #define AR724X_REV_ID_REVISION_MASK 0x3 184*d4a67d9dSGabor Juhos 185*d4a67d9dSGabor Juhos /* 186*d4a67d9dSGabor Juhos * SPI block 187*d4a67d9dSGabor Juhos */ 188*d4a67d9dSGabor Juhos #define AR71XX_SPI_REG_FS 0x00 /* Function Select */ 189*d4a67d9dSGabor Juhos #define AR71XX_SPI_REG_CTRL 0x04 /* SPI Control */ 190*d4a67d9dSGabor Juhos #define AR71XX_SPI_REG_IOC 0x08 /* SPI I/O Control */ 191*d4a67d9dSGabor Juhos #define AR71XX_SPI_REG_RDS 0x0c /* Read Data Shift */ 192*d4a67d9dSGabor Juhos 193*d4a67d9dSGabor Juhos #define AR71XX_SPI_FS_GPIO BIT(0) /* Enable GPIO mode */ 194*d4a67d9dSGabor Juhos 195*d4a67d9dSGabor Juhos #define AR71XX_SPI_CTRL_RD BIT(6) /* Remap Disable */ 196*d4a67d9dSGabor Juhos #define AR71XX_SPI_CTRL_DIV_MASK 0x3f 197*d4a67d9dSGabor Juhos 198*d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_DO BIT(0) /* Data Out pin */ 199*d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_CLK BIT(8) /* CLK pin */ 200*d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_CS(n) BIT(16 + (n)) 201*d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_CS0 AR71XX_SPI_IOC_CS(0) 202*d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_CS1 AR71XX_SPI_IOC_CS(1) 203*d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_CS2 AR71XX_SPI_IOC_CS(2) 204*d4a67d9dSGabor Juhos #define AR71XX_SPI_IOC_CS_ALL (AR71XX_SPI_IOC_CS0 | AR71XX_SPI_IOC_CS1 | \ 205*d4a67d9dSGabor Juhos AR71XX_SPI_IOC_CS2) 206*d4a67d9dSGabor Juhos 207*d4a67d9dSGabor Juhos #endif /* __ASM_MACH_AR71XX_REGS_H */ 208