18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 38c2ecf20Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 48c2ecf20Sopenharmony_ci * for more details. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (C) 2003 Atheros Communications, Inc., All Rights Reserved. 78c2ecf20Sopenharmony_ci * Copyright (C) 2006 Imre Kaloz <kaloz@openwrt.org> 88c2ecf20Sopenharmony_ci * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org> 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#ifndef __ASM_MACH_ATH25_AR5312_REGS_H 128c2ecf20Sopenharmony_ci#define __ASM_MACH_ATH25_AR5312_REGS_H 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci/* 158c2ecf20Sopenharmony_ci * IRQs 168c2ecf20Sopenharmony_ci */ 178c2ecf20Sopenharmony_ci#define AR5312_IRQ_WLAN0 (MIPS_CPU_IRQ_BASE + 2) /* C0_CAUSE: 0x0400 */ 188c2ecf20Sopenharmony_ci#define AR5312_IRQ_ENET0 (MIPS_CPU_IRQ_BASE + 3) /* C0_CAUSE: 0x0800 */ 198c2ecf20Sopenharmony_ci#define AR5312_IRQ_ENET1 (MIPS_CPU_IRQ_BASE + 4) /* C0_CAUSE: 0x1000 */ 208c2ecf20Sopenharmony_ci#define AR5312_IRQ_WLAN1 (MIPS_CPU_IRQ_BASE + 5) /* C0_CAUSE: 0x2000 */ 218c2ecf20Sopenharmony_ci#define AR5312_IRQ_MISC (MIPS_CPU_IRQ_BASE + 6) /* C0_CAUSE: 0x4000 */ 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci/* 248c2ecf20Sopenharmony_ci * Miscellaneous interrupts, which share IP6. 258c2ecf20Sopenharmony_ci */ 268c2ecf20Sopenharmony_ci#define AR5312_MISC_IRQ_TIMER 0 278c2ecf20Sopenharmony_ci#define AR5312_MISC_IRQ_AHB_PROC 1 288c2ecf20Sopenharmony_ci#define AR5312_MISC_IRQ_AHB_DMA 2 298c2ecf20Sopenharmony_ci#define AR5312_MISC_IRQ_GPIO 3 308c2ecf20Sopenharmony_ci#define AR5312_MISC_IRQ_UART0 4 318c2ecf20Sopenharmony_ci#define AR5312_MISC_IRQ_UART0_DMA 5 328c2ecf20Sopenharmony_ci#define AR5312_MISC_IRQ_WATCHDOG 6 338c2ecf20Sopenharmony_ci#define AR5312_MISC_IRQ_LOCAL 7 348c2ecf20Sopenharmony_ci#define AR5312_MISC_IRQ_SPI 8 358c2ecf20Sopenharmony_ci#define AR5312_MISC_IRQ_COUNT 9 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci/* 388c2ecf20Sopenharmony_ci * Address Map 398c2ecf20Sopenharmony_ci * 408c2ecf20Sopenharmony_ci * The AR5312 supports 2 enet MACS, even though many reference boards only 418c2ecf20Sopenharmony_ci * actually use 1 of them (i.e. Only MAC 0 is actually connected to an enet 428c2ecf20Sopenharmony_ci * PHY or PHY switch. The AR2312 supports 1 enet MAC. 438c2ecf20Sopenharmony_ci */ 448c2ecf20Sopenharmony_ci#define AR5312_WLAN0_BASE 0x18000000 458c2ecf20Sopenharmony_ci#define AR5312_ENET0_BASE 0x18100000 468c2ecf20Sopenharmony_ci#define AR5312_ENET1_BASE 0x18200000 478c2ecf20Sopenharmony_ci#define AR5312_SDRAMCTL_BASE 0x18300000 488c2ecf20Sopenharmony_ci#define AR5312_SDRAMCTL_SIZE 0x00000010 498c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_BASE 0x18400000 508c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_SIZE 0x00000010 518c2ecf20Sopenharmony_ci#define AR5312_WLAN1_BASE 0x18500000 528c2ecf20Sopenharmony_ci#define AR5312_UART0_BASE 0x1c000000 /* UART MMR */ 538c2ecf20Sopenharmony_ci#define AR5312_GPIO_BASE 0x1c002000 548c2ecf20Sopenharmony_ci#define AR5312_GPIO_SIZE 0x00000010 558c2ecf20Sopenharmony_ci#define AR5312_RST_BASE 0x1c003000 568c2ecf20Sopenharmony_ci#define AR5312_RST_SIZE 0x00000100 578c2ecf20Sopenharmony_ci#define AR5312_FLASH_BASE 0x1e000000 588c2ecf20Sopenharmony_ci#define AR5312_FLASH_SIZE 0x00800000 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci/* 618c2ecf20Sopenharmony_ci * Need these defines to determine true number of ethernet MACs 628c2ecf20Sopenharmony_ci */ 638c2ecf20Sopenharmony_ci#define AR5312_AR5312_REV2 0x0052 /* AR5312 WMAC (AP31) */ 648c2ecf20Sopenharmony_ci#define AR5312_AR5312_REV7 0x0057 /* AR5312 WMAC (AP30-040) */ 658c2ecf20Sopenharmony_ci#define AR5312_AR2313_REV8 0x0058 /* AR2313 WMAC (AP43-030) */ 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci/* Reset/Timer Block Address Map */ 688c2ecf20Sopenharmony_ci#define AR5312_TIMER 0x0000 /* countdown timer */ 698c2ecf20Sopenharmony_ci#define AR5312_RELOAD 0x0004 /* timer reload value */ 708c2ecf20Sopenharmony_ci#define AR5312_WDT_CTRL 0x0008 /* watchdog cntrl */ 718c2ecf20Sopenharmony_ci#define AR5312_WDT_TIMER 0x000c /* watchdog timer */ 728c2ecf20Sopenharmony_ci#define AR5312_ISR 0x0010 /* Intr Status Reg */ 738c2ecf20Sopenharmony_ci#define AR5312_IMR 0x0014 /* Intr Mask Reg */ 748c2ecf20Sopenharmony_ci#define AR5312_RESET 0x0020 758c2ecf20Sopenharmony_ci#define AR5312_CLOCKCTL1 0x0064 768c2ecf20Sopenharmony_ci#define AR5312_SCRATCH 0x006c 778c2ecf20Sopenharmony_ci#define AR5312_PROCADDR 0x0070 788c2ecf20Sopenharmony_ci#define AR5312_PROC1 0x0074 798c2ecf20Sopenharmony_ci#define AR5312_DMAADDR 0x0078 808c2ecf20Sopenharmony_ci#define AR5312_DMA1 0x007c 818c2ecf20Sopenharmony_ci#define AR5312_ENABLE 0x0080 /* interface enb */ 828c2ecf20Sopenharmony_ci#define AR5312_REV 0x0090 /* revision */ 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci/* AR5312_WDT_CTRL register bit field definitions */ 858c2ecf20Sopenharmony_ci#define AR5312_WDT_CTRL_IGNORE 0x00000000 /* ignore expiration */ 868c2ecf20Sopenharmony_ci#define AR5312_WDT_CTRL_NMI 0x00000001 878c2ecf20Sopenharmony_ci#define AR5312_WDT_CTRL_RESET 0x00000002 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci/* AR5312_ISR register bit field definitions */ 908c2ecf20Sopenharmony_ci#define AR5312_ISR_TIMER 0x00000001 918c2ecf20Sopenharmony_ci#define AR5312_ISR_AHBPROC 0x00000002 928c2ecf20Sopenharmony_ci#define AR5312_ISR_AHBDMA 0x00000004 938c2ecf20Sopenharmony_ci#define AR5312_ISR_GPIO 0x00000008 948c2ecf20Sopenharmony_ci#define AR5312_ISR_UART0 0x00000010 958c2ecf20Sopenharmony_ci#define AR5312_ISR_UART0DMA 0x00000020 968c2ecf20Sopenharmony_ci#define AR5312_ISR_WD 0x00000040 978c2ecf20Sopenharmony_ci#define AR5312_ISR_LOCAL 0x00000080 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci/* AR5312_RESET register bit field definitions */ 1008c2ecf20Sopenharmony_ci#define AR5312_RESET_SYSTEM 0x00000001 /* cold reset full system */ 1018c2ecf20Sopenharmony_ci#define AR5312_RESET_PROC 0x00000002 /* cold reset MIPS core */ 1028c2ecf20Sopenharmony_ci#define AR5312_RESET_WLAN0 0x00000004 /* cold reset WLAN MAC/BB */ 1038c2ecf20Sopenharmony_ci#define AR5312_RESET_EPHY0 0x00000008 /* cold reset ENET0 phy */ 1048c2ecf20Sopenharmony_ci#define AR5312_RESET_EPHY1 0x00000010 /* cold reset ENET1 phy */ 1058c2ecf20Sopenharmony_ci#define AR5312_RESET_ENET0 0x00000020 /* cold reset ENET0 MAC */ 1068c2ecf20Sopenharmony_ci#define AR5312_RESET_ENET1 0x00000040 /* cold reset ENET1 MAC */ 1078c2ecf20Sopenharmony_ci#define AR5312_RESET_UART0 0x00000100 /* cold reset UART0 */ 1088c2ecf20Sopenharmony_ci#define AR5312_RESET_WLAN1 0x00000200 /* cold reset WLAN MAC/BB */ 1098c2ecf20Sopenharmony_ci#define AR5312_RESET_APB 0x00000400 /* cold reset APB ar5312 */ 1108c2ecf20Sopenharmony_ci#define AR5312_RESET_WARM_PROC 0x00001000 /* warm reset MIPS core */ 1118c2ecf20Sopenharmony_ci#define AR5312_RESET_WARM_WLAN0_MAC 0x00002000 /* warm reset WLAN0 MAC */ 1128c2ecf20Sopenharmony_ci#define AR5312_RESET_WARM_WLAN0_BB 0x00004000 /* warm reset WLAN0 BB */ 1138c2ecf20Sopenharmony_ci#define AR5312_RESET_NMI 0x00010000 /* send an NMI to the CPU */ 1148c2ecf20Sopenharmony_ci#define AR5312_RESET_WARM_WLAN1_MAC 0x00020000 /* warm reset WLAN1 MAC */ 1158c2ecf20Sopenharmony_ci#define AR5312_RESET_WARM_WLAN1_BB 0x00040000 /* warm reset WLAN1 BB */ 1168c2ecf20Sopenharmony_ci#define AR5312_RESET_LOCAL_BUS 0x00080000 /* reset local bus */ 1178c2ecf20Sopenharmony_ci#define AR5312_RESET_WDOG 0x00100000 /* last reset was a wdt */ 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci#define AR5312_RESET_WMAC0_BITS (AR5312_RESET_WLAN0 |\ 1208c2ecf20Sopenharmony_ci AR5312_RESET_WARM_WLAN0_MAC |\ 1218c2ecf20Sopenharmony_ci AR5312_RESET_WARM_WLAN0_BB) 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci#define AR5312_RESET_WMAC1_BITS (AR5312_RESET_WLAN1 |\ 1248c2ecf20Sopenharmony_ci AR5312_RESET_WARM_WLAN1_MAC |\ 1258c2ecf20Sopenharmony_ci AR5312_RESET_WARM_WLAN1_BB) 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci/* AR5312_CLOCKCTL1 register bit field definitions */ 1288c2ecf20Sopenharmony_ci#define AR5312_CLOCKCTL1_PREDIVIDE_MASK 0x00000030 1298c2ecf20Sopenharmony_ci#define AR5312_CLOCKCTL1_PREDIVIDE_SHIFT 4 1308c2ecf20Sopenharmony_ci#define AR5312_CLOCKCTL1_MULTIPLIER_MASK 0x00001f00 1318c2ecf20Sopenharmony_ci#define AR5312_CLOCKCTL1_MULTIPLIER_SHIFT 8 1328c2ecf20Sopenharmony_ci#define AR5312_CLOCKCTL1_DOUBLER_MASK 0x00010000 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci/* Valid for AR5312 and AR2312 */ 1358c2ecf20Sopenharmony_ci#define AR5312_CLOCKCTL1_PREDIVIDE_MASK 0x00000030 1368c2ecf20Sopenharmony_ci#define AR5312_CLOCKCTL1_PREDIVIDE_SHIFT 4 1378c2ecf20Sopenharmony_ci#define AR5312_CLOCKCTL1_MULTIPLIER_MASK 0x00001f00 1388c2ecf20Sopenharmony_ci#define AR5312_CLOCKCTL1_MULTIPLIER_SHIFT 8 1398c2ecf20Sopenharmony_ci#define AR5312_CLOCKCTL1_DOUBLER_MASK 0x00010000 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci/* Valid for AR2313 */ 1428c2ecf20Sopenharmony_ci#define AR2313_CLOCKCTL1_PREDIVIDE_MASK 0x00003000 1438c2ecf20Sopenharmony_ci#define AR2313_CLOCKCTL1_PREDIVIDE_SHIFT 12 1448c2ecf20Sopenharmony_ci#define AR2313_CLOCKCTL1_MULTIPLIER_MASK 0x001f0000 1458c2ecf20Sopenharmony_ci#define AR2313_CLOCKCTL1_MULTIPLIER_SHIFT 16 1468c2ecf20Sopenharmony_ci#define AR2313_CLOCKCTL1_DOUBLER_MASK 0x00000000 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci/* AR5312_ENABLE register bit field definitions */ 1498c2ecf20Sopenharmony_ci#define AR5312_ENABLE_WLAN0 0x00000001 1508c2ecf20Sopenharmony_ci#define AR5312_ENABLE_ENET0 0x00000002 1518c2ecf20Sopenharmony_ci#define AR5312_ENABLE_ENET1 0x00000004 1528c2ecf20Sopenharmony_ci#define AR5312_ENABLE_UART_AND_WLAN1_PIO 0x00000008/* UART & WLAN1 PIO */ 1538c2ecf20Sopenharmony_ci#define AR5312_ENABLE_WLAN1_DMA 0x00000010/* WLAN1 DMAs */ 1548c2ecf20Sopenharmony_ci#define AR5312_ENABLE_WLAN1 (AR5312_ENABLE_UART_AND_WLAN1_PIO |\ 1558c2ecf20Sopenharmony_ci AR5312_ENABLE_WLAN1_DMA) 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci/* AR5312_REV register bit field definitions */ 1588c2ecf20Sopenharmony_ci#define AR5312_REV_WMAC_MAJ 0x0000f000 1598c2ecf20Sopenharmony_ci#define AR5312_REV_WMAC_MAJ_S 12 1608c2ecf20Sopenharmony_ci#define AR5312_REV_WMAC_MIN 0x00000f00 1618c2ecf20Sopenharmony_ci#define AR5312_REV_WMAC_MIN_S 8 1628c2ecf20Sopenharmony_ci#define AR5312_REV_MAJ 0x000000f0 1638c2ecf20Sopenharmony_ci#define AR5312_REV_MAJ_S 4 1648c2ecf20Sopenharmony_ci#define AR5312_REV_MIN 0x0000000f 1658c2ecf20Sopenharmony_ci#define AR5312_REV_MIN_S 0 1668c2ecf20Sopenharmony_ci#define AR5312_REV_CHIP (AR5312_REV_MAJ|AR5312_REV_MIN) 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_ci/* Major revision numbers, bits 7..4 of Revision ID register */ 1698c2ecf20Sopenharmony_ci#define AR5312_REV_MAJ_AR5312 0x4 1708c2ecf20Sopenharmony_ci#define AR5312_REV_MAJ_AR2313 0x5 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci/* Minor revision numbers, bits 3..0 of Revision ID register */ 1738c2ecf20Sopenharmony_ci#define AR5312_REV_MIN_DUAL 0x0 /* Dual WLAN version */ 1748c2ecf20Sopenharmony_ci#define AR5312_REV_MIN_SINGLE 0x1 /* Single WLAN version */ 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci/* 1778c2ecf20Sopenharmony_ci * ARM Flash Controller -- 3 flash banks with either x8 or x16 devices 1788c2ecf20Sopenharmony_ci */ 1798c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL0 0x0000 1808c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL1 0x0004 1818c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL2 0x0008 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci/* AR5312_FLASHCTL register bit field definitions */ 1848c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_IDCY 0x0000000f /* Idle cycle turnaround time */ 1858c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_IDCY_S 0 1868c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_WST1 0x000003e0 /* Wait state 1 */ 1878c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_WST1_S 5 1888c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_RBLE 0x00000400 /* Read byte lane enable */ 1898c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_WST2 0x0000f800 /* Wait state 2 */ 1908c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_WST2_S 11 1918c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_AC 0x00070000 /* Flash addr check (added) */ 1928c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_AC_S 16 1938c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_AC_128K 0x00000000 1948c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_AC_256K 0x00010000 1958c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_AC_512K 0x00020000 1968c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_AC_1M 0x00030000 1978c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_AC_2M 0x00040000 1988c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_AC_4M 0x00050000 1998c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_AC_8M 0x00060000 2008c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_AC_RES 0x00070000 /* 16MB is not supported */ 2018c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_E 0x00080000 /* Flash bank enable (added) */ 2028c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_BUSERR 0x01000000 /* Bus transfer error flag */ 2038c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_WPERR 0x02000000 /* Write protect error flag */ 2048c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_WP 0x04000000 /* Write protect */ 2058c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_BM 0x08000000 /* Burst mode */ 2068c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_MW 0x30000000 /* Mem width */ 2078c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_MW8 0x00000000 /* Mem width x8 */ 2088c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_MW16 0x10000000 /* Mem width x16 */ 2098c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_MW32 0x20000000 /* Mem width x32 (not supp) */ 2108c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_ATNR 0x00000000 /* Access == no retry */ 2118c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_ATR 0x80000000 /* Access == retry every */ 2128c2ecf20Sopenharmony_ci#define AR5312_FLASHCTL_ATR4 0xc0000000 /* Access == retry every 4 */ 2138c2ecf20Sopenharmony_ci 2148c2ecf20Sopenharmony_ci/* 2158c2ecf20Sopenharmony_ci * ARM SDRAM Controller -- just enough to determine memory size 2168c2ecf20Sopenharmony_ci */ 2178c2ecf20Sopenharmony_ci#define AR5312_MEM_CFG1 0x0004 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci#define AR5312_MEM_CFG1_AC0_M 0x00000700 /* bank 0: SDRAM addr check */ 2208c2ecf20Sopenharmony_ci#define AR5312_MEM_CFG1_AC0_S 8 2218c2ecf20Sopenharmony_ci#define AR5312_MEM_CFG1_AC1_M 0x00007000 /* bank 1: SDRAM addr check */ 2228c2ecf20Sopenharmony_ci#define AR5312_MEM_CFG1_AC1_S 12 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ci#endif /* __ASM_MACH_ATH25_AR5312_REGS_H */ 225