162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 362306a36Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 462306a36Sopenharmony_ci * for more details. 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * Copyright (C) 2003 Atheros Communications, Inc., All Rights Reserved. 762306a36Sopenharmony_ci * Copyright (C) 2006 Imre Kaloz <kaloz@openwrt.org> 862306a36Sopenharmony_ci * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org> 962306a36Sopenharmony_ci */ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#ifndef __ASM_MACH_ATH25_AR5312_REGS_H 1262306a36Sopenharmony_ci#define __ASM_MACH_ATH25_AR5312_REGS_H 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci/* 1562306a36Sopenharmony_ci * IRQs 1662306a36Sopenharmony_ci */ 1762306a36Sopenharmony_ci#define AR5312_IRQ_WLAN0 (MIPS_CPU_IRQ_BASE + 2) /* C0_CAUSE: 0x0400 */ 1862306a36Sopenharmony_ci#define AR5312_IRQ_ENET0 (MIPS_CPU_IRQ_BASE + 3) /* C0_CAUSE: 0x0800 */ 1962306a36Sopenharmony_ci#define AR5312_IRQ_ENET1 (MIPS_CPU_IRQ_BASE + 4) /* C0_CAUSE: 0x1000 */ 2062306a36Sopenharmony_ci#define AR5312_IRQ_WLAN1 (MIPS_CPU_IRQ_BASE + 5) /* C0_CAUSE: 0x2000 */ 2162306a36Sopenharmony_ci#define AR5312_IRQ_MISC (MIPS_CPU_IRQ_BASE + 6) /* C0_CAUSE: 0x4000 */ 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci/* 2462306a36Sopenharmony_ci * Miscellaneous interrupts, which share IP6. 2562306a36Sopenharmony_ci */ 2662306a36Sopenharmony_ci#define AR5312_MISC_IRQ_TIMER 0 2762306a36Sopenharmony_ci#define AR5312_MISC_IRQ_AHB_PROC 1 2862306a36Sopenharmony_ci#define AR5312_MISC_IRQ_AHB_DMA 2 2962306a36Sopenharmony_ci#define AR5312_MISC_IRQ_GPIO 3 3062306a36Sopenharmony_ci#define AR5312_MISC_IRQ_UART0 4 3162306a36Sopenharmony_ci#define AR5312_MISC_IRQ_UART0_DMA 5 3262306a36Sopenharmony_ci#define AR5312_MISC_IRQ_WATCHDOG 6 3362306a36Sopenharmony_ci#define AR5312_MISC_IRQ_LOCAL 7 3462306a36Sopenharmony_ci#define AR5312_MISC_IRQ_SPI 8 3562306a36Sopenharmony_ci#define AR5312_MISC_IRQ_COUNT 9 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci/* 3862306a36Sopenharmony_ci * Address Map 3962306a36Sopenharmony_ci * 4062306a36Sopenharmony_ci * The AR5312 supports 2 enet MACS, even though many reference boards only 4162306a36Sopenharmony_ci * actually use 1 of them (i.e. Only MAC 0 is actually connected to an enet 4262306a36Sopenharmony_ci * PHY or PHY switch. The AR2312 supports 1 enet MAC. 4362306a36Sopenharmony_ci */ 4462306a36Sopenharmony_ci#define AR5312_WLAN0_BASE 0x18000000 4562306a36Sopenharmony_ci#define AR5312_ENET0_BASE 0x18100000 4662306a36Sopenharmony_ci#define AR5312_ENET1_BASE 0x18200000 4762306a36Sopenharmony_ci#define AR5312_SDRAMCTL_BASE 0x18300000 4862306a36Sopenharmony_ci#define AR5312_SDRAMCTL_SIZE 0x00000010 4962306a36Sopenharmony_ci#define AR5312_FLASHCTL_BASE 0x18400000 5062306a36Sopenharmony_ci#define AR5312_FLASHCTL_SIZE 0x00000010 5162306a36Sopenharmony_ci#define AR5312_WLAN1_BASE 0x18500000 5262306a36Sopenharmony_ci#define AR5312_UART0_BASE 0x1c000000 /* UART MMR */ 5362306a36Sopenharmony_ci#define AR5312_GPIO_BASE 0x1c002000 5462306a36Sopenharmony_ci#define AR5312_GPIO_SIZE 0x00000010 5562306a36Sopenharmony_ci#define AR5312_RST_BASE 0x1c003000 5662306a36Sopenharmony_ci#define AR5312_RST_SIZE 0x00000100 5762306a36Sopenharmony_ci#define AR5312_FLASH_BASE 0x1e000000 5862306a36Sopenharmony_ci#define AR5312_FLASH_SIZE 0x00800000 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci/* 6162306a36Sopenharmony_ci * Need these defines to determine true number of ethernet MACs 6262306a36Sopenharmony_ci */ 6362306a36Sopenharmony_ci#define AR5312_AR5312_REV2 0x0052 /* AR5312 WMAC (AP31) */ 6462306a36Sopenharmony_ci#define AR5312_AR5312_REV7 0x0057 /* AR5312 WMAC (AP30-040) */ 6562306a36Sopenharmony_ci#define AR5312_AR2313_REV8 0x0058 /* AR2313 WMAC (AP43-030) */ 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci/* Reset/Timer Block Address Map */ 6862306a36Sopenharmony_ci#define AR5312_TIMER 0x0000 /* countdown timer */ 6962306a36Sopenharmony_ci#define AR5312_RELOAD 0x0004 /* timer reload value */ 7062306a36Sopenharmony_ci#define AR5312_WDT_CTRL 0x0008 /* watchdog cntrl */ 7162306a36Sopenharmony_ci#define AR5312_WDT_TIMER 0x000c /* watchdog timer */ 7262306a36Sopenharmony_ci#define AR5312_ISR 0x0010 /* Intr Status Reg */ 7362306a36Sopenharmony_ci#define AR5312_IMR 0x0014 /* Intr Mask Reg */ 7462306a36Sopenharmony_ci#define AR5312_RESET 0x0020 7562306a36Sopenharmony_ci#define AR5312_CLOCKCTL1 0x0064 7662306a36Sopenharmony_ci#define AR5312_SCRATCH 0x006c 7762306a36Sopenharmony_ci#define AR5312_PROCADDR 0x0070 7862306a36Sopenharmony_ci#define AR5312_PROC1 0x0074 7962306a36Sopenharmony_ci#define AR5312_DMAADDR 0x0078 8062306a36Sopenharmony_ci#define AR5312_DMA1 0x007c 8162306a36Sopenharmony_ci#define AR5312_ENABLE 0x0080 /* interface enb */ 8262306a36Sopenharmony_ci#define AR5312_REV 0x0090 /* revision */ 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci/* AR5312_WDT_CTRL register bit field definitions */ 8562306a36Sopenharmony_ci#define AR5312_WDT_CTRL_IGNORE 0x00000000 /* ignore expiration */ 8662306a36Sopenharmony_ci#define AR5312_WDT_CTRL_NMI 0x00000001 8762306a36Sopenharmony_ci#define AR5312_WDT_CTRL_RESET 0x00000002 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ci/* AR5312_ISR register bit field definitions */ 9062306a36Sopenharmony_ci#define AR5312_ISR_TIMER 0x00000001 9162306a36Sopenharmony_ci#define AR5312_ISR_AHBPROC 0x00000002 9262306a36Sopenharmony_ci#define AR5312_ISR_AHBDMA 0x00000004 9362306a36Sopenharmony_ci#define AR5312_ISR_GPIO 0x00000008 9462306a36Sopenharmony_ci#define AR5312_ISR_UART0 0x00000010 9562306a36Sopenharmony_ci#define AR5312_ISR_UART0DMA 0x00000020 9662306a36Sopenharmony_ci#define AR5312_ISR_WD 0x00000040 9762306a36Sopenharmony_ci#define AR5312_ISR_LOCAL 0x00000080 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci/* AR5312_RESET register bit field definitions */ 10062306a36Sopenharmony_ci#define AR5312_RESET_SYSTEM 0x00000001 /* cold reset full system */ 10162306a36Sopenharmony_ci#define AR5312_RESET_PROC 0x00000002 /* cold reset MIPS core */ 10262306a36Sopenharmony_ci#define AR5312_RESET_WLAN0 0x00000004 /* cold reset WLAN MAC/BB */ 10362306a36Sopenharmony_ci#define AR5312_RESET_EPHY0 0x00000008 /* cold reset ENET0 phy */ 10462306a36Sopenharmony_ci#define AR5312_RESET_EPHY1 0x00000010 /* cold reset ENET1 phy */ 10562306a36Sopenharmony_ci#define AR5312_RESET_ENET0 0x00000020 /* cold reset ENET0 MAC */ 10662306a36Sopenharmony_ci#define AR5312_RESET_ENET1 0x00000040 /* cold reset ENET1 MAC */ 10762306a36Sopenharmony_ci#define AR5312_RESET_UART0 0x00000100 /* cold reset UART0 */ 10862306a36Sopenharmony_ci#define AR5312_RESET_WLAN1 0x00000200 /* cold reset WLAN MAC/BB */ 10962306a36Sopenharmony_ci#define AR5312_RESET_APB 0x00000400 /* cold reset APB ar5312 */ 11062306a36Sopenharmony_ci#define AR5312_RESET_WARM_PROC 0x00001000 /* warm reset MIPS core */ 11162306a36Sopenharmony_ci#define AR5312_RESET_WARM_WLAN0_MAC 0x00002000 /* warm reset WLAN0 MAC */ 11262306a36Sopenharmony_ci#define AR5312_RESET_WARM_WLAN0_BB 0x00004000 /* warm reset WLAN0 BB */ 11362306a36Sopenharmony_ci#define AR5312_RESET_NMI 0x00010000 /* send an NMI to the CPU */ 11462306a36Sopenharmony_ci#define AR5312_RESET_WARM_WLAN1_MAC 0x00020000 /* warm reset WLAN1 MAC */ 11562306a36Sopenharmony_ci#define AR5312_RESET_WARM_WLAN1_BB 0x00040000 /* warm reset WLAN1 BB */ 11662306a36Sopenharmony_ci#define AR5312_RESET_LOCAL_BUS 0x00080000 /* reset local bus */ 11762306a36Sopenharmony_ci#define AR5312_RESET_WDOG 0x00100000 /* last reset was a wdt */ 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci#define AR5312_RESET_WMAC0_BITS (AR5312_RESET_WLAN0 |\ 12062306a36Sopenharmony_ci AR5312_RESET_WARM_WLAN0_MAC |\ 12162306a36Sopenharmony_ci AR5312_RESET_WARM_WLAN0_BB) 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci#define AR5312_RESET_WMAC1_BITS (AR5312_RESET_WLAN1 |\ 12462306a36Sopenharmony_ci AR5312_RESET_WARM_WLAN1_MAC |\ 12562306a36Sopenharmony_ci AR5312_RESET_WARM_WLAN1_BB) 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci/* AR5312_CLOCKCTL1 register bit field definitions */ 12862306a36Sopenharmony_ci#define AR5312_CLOCKCTL1_PREDIVIDE_MASK 0x00000030 12962306a36Sopenharmony_ci#define AR5312_CLOCKCTL1_PREDIVIDE_SHIFT 4 13062306a36Sopenharmony_ci#define AR5312_CLOCKCTL1_MULTIPLIER_MASK 0x00001f00 13162306a36Sopenharmony_ci#define AR5312_CLOCKCTL1_MULTIPLIER_SHIFT 8 13262306a36Sopenharmony_ci#define AR5312_CLOCKCTL1_DOUBLER_MASK 0x00010000 13362306a36Sopenharmony_ci 13462306a36Sopenharmony_ci/* Valid for AR5312 and AR2312 */ 13562306a36Sopenharmony_ci#define AR5312_CLOCKCTL1_PREDIVIDE_MASK 0x00000030 13662306a36Sopenharmony_ci#define AR5312_CLOCKCTL1_PREDIVIDE_SHIFT 4 13762306a36Sopenharmony_ci#define AR5312_CLOCKCTL1_MULTIPLIER_MASK 0x00001f00 13862306a36Sopenharmony_ci#define AR5312_CLOCKCTL1_MULTIPLIER_SHIFT 8 13962306a36Sopenharmony_ci#define AR5312_CLOCKCTL1_DOUBLER_MASK 0x00010000 14062306a36Sopenharmony_ci 14162306a36Sopenharmony_ci/* Valid for AR2313 */ 14262306a36Sopenharmony_ci#define AR2313_CLOCKCTL1_PREDIVIDE_MASK 0x00003000 14362306a36Sopenharmony_ci#define AR2313_CLOCKCTL1_PREDIVIDE_SHIFT 12 14462306a36Sopenharmony_ci#define AR2313_CLOCKCTL1_MULTIPLIER_MASK 0x001f0000 14562306a36Sopenharmony_ci#define AR2313_CLOCKCTL1_MULTIPLIER_SHIFT 16 14662306a36Sopenharmony_ci#define AR2313_CLOCKCTL1_DOUBLER_MASK 0x00000000 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ci/* AR5312_ENABLE register bit field definitions */ 14962306a36Sopenharmony_ci#define AR5312_ENABLE_WLAN0 0x00000001 15062306a36Sopenharmony_ci#define AR5312_ENABLE_ENET0 0x00000002 15162306a36Sopenharmony_ci#define AR5312_ENABLE_ENET1 0x00000004 15262306a36Sopenharmony_ci#define AR5312_ENABLE_UART_AND_WLAN1_PIO 0x00000008/* UART & WLAN1 PIO */ 15362306a36Sopenharmony_ci#define AR5312_ENABLE_WLAN1_DMA 0x00000010/* WLAN1 DMAs */ 15462306a36Sopenharmony_ci#define AR5312_ENABLE_WLAN1 (AR5312_ENABLE_UART_AND_WLAN1_PIO |\ 15562306a36Sopenharmony_ci AR5312_ENABLE_WLAN1_DMA) 15662306a36Sopenharmony_ci 15762306a36Sopenharmony_ci/* AR5312_REV register bit field definitions */ 15862306a36Sopenharmony_ci#define AR5312_REV_WMAC_MAJ 0x0000f000 15962306a36Sopenharmony_ci#define AR5312_REV_WMAC_MAJ_S 12 16062306a36Sopenharmony_ci#define AR5312_REV_WMAC_MIN 0x00000f00 16162306a36Sopenharmony_ci#define AR5312_REV_WMAC_MIN_S 8 16262306a36Sopenharmony_ci#define AR5312_REV_MAJ 0x000000f0 16362306a36Sopenharmony_ci#define AR5312_REV_MAJ_S 4 16462306a36Sopenharmony_ci#define AR5312_REV_MIN 0x0000000f 16562306a36Sopenharmony_ci#define AR5312_REV_MIN_S 0 16662306a36Sopenharmony_ci#define AR5312_REV_CHIP (AR5312_REV_MAJ|AR5312_REV_MIN) 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci/* Major revision numbers, bits 7..4 of Revision ID register */ 16962306a36Sopenharmony_ci#define AR5312_REV_MAJ_AR5312 0x4 17062306a36Sopenharmony_ci#define AR5312_REV_MAJ_AR2313 0x5 17162306a36Sopenharmony_ci 17262306a36Sopenharmony_ci/* Minor revision numbers, bits 3..0 of Revision ID register */ 17362306a36Sopenharmony_ci#define AR5312_REV_MIN_DUAL 0x0 /* Dual WLAN version */ 17462306a36Sopenharmony_ci#define AR5312_REV_MIN_SINGLE 0x1 /* Single WLAN version */ 17562306a36Sopenharmony_ci 17662306a36Sopenharmony_ci/* 17762306a36Sopenharmony_ci * ARM Flash Controller -- 3 flash banks with either x8 or x16 devices 17862306a36Sopenharmony_ci */ 17962306a36Sopenharmony_ci#define AR5312_FLASHCTL0 0x0000 18062306a36Sopenharmony_ci#define AR5312_FLASHCTL1 0x0004 18162306a36Sopenharmony_ci#define AR5312_FLASHCTL2 0x0008 18262306a36Sopenharmony_ci 18362306a36Sopenharmony_ci/* AR5312_FLASHCTL register bit field definitions */ 18462306a36Sopenharmony_ci#define AR5312_FLASHCTL_IDCY 0x0000000f /* Idle cycle turnaround time */ 18562306a36Sopenharmony_ci#define AR5312_FLASHCTL_IDCY_S 0 18662306a36Sopenharmony_ci#define AR5312_FLASHCTL_WST1 0x000003e0 /* Wait state 1 */ 18762306a36Sopenharmony_ci#define AR5312_FLASHCTL_WST1_S 5 18862306a36Sopenharmony_ci#define AR5312_FLASHCTL_RBLE 0x00000400 /* Read byte lane enable */ 18962306a36Sopenharmony_ci#define AR5312_FLASHCTL_WST2 0x0000f800 /* Wait state 2 */ 19062306a36Sopenharmony_ci#define AR5312_FLASHCTL_WST2_S 11 19162306a36Sopenharmony_ci#define AR5312_FLASHCTL_AC 0x00070000 /* Flash addr check (added) */ 19262306a36Sopenharmony_ci#define AR5312_FLASHCTL_AC_S 16 19362306a36Sopenharmony_ci#define AR5312_FLASHCTL_AC_128K 0x00000000 19462306a36Sopenharmony_ci#define AR5312_FLASHCTL_AC_256K 0x00010000 19562306a36Sopenharmony_ci#define AR5312_FLASHCTL_AC_512K 0x00020000 19662306a36Sopenharmony_ci#define AR5312_FLASHCTL_AC_1M 0x00030000 19762306a36Sopenharmony_ci#define AR5312_FLASHCTL_AC_2M 0x00040000 19862306a36Sopenharmony_ci#define AR5312_FLASHCTL_AC_4M 0x00050000 19962306a36Sopenharmony_ci#define AR5312_FLASHCTL_AC_8M 0x00060000 20062306a36Sopenharmony_ci#define AR5312_FLASHCTL_AC_RES 0x00070000 /* 16MB is not supported */ 20162306a36Sopenharmony_ci#define AR5312_FLASHCTL_E 0x00080000 /* Flash bank enable (added) */ 20262306a36Sopenharmony_ci#define AR5312_FLASHCTL_BUSERR 0x01000000 /* Bus transfer error flag */ 20362306a36Sopenharmony_ci#define AR5312_FLASHCTL_WPERR 0x02000000 /* Write protect error flag */ 20462306a36Sopenharmony_ci#define AR5312_FLASHCTL_WP 0x04000000 /* Write protect */ 20562306a36Sopenharmony_ci#define AR5312_FLASHCTL_BM 0x08000000 /* Burst mode */ 20662306a36Sopenharmony_ci#define AR5312_FLASHCTL_MW 0x30000000 /* Mem width */ 20762306a36Sopenharmony_ci#define AR5312_FLASHCTL_MW8 0x00000000 /* Mem width x8 */ 20862306a36Sopenharmony_ci#define AR5312_FLASHCTL_MW16 0x10000000 /* Mem width x16 */ 20962306a36Sopenharmony_ci#define AR5312_FLASHCTL_MW32 0x20000000 /* Mem width x32 (not supp) */ 21062306a36Sopenharmony_ci#define AR5312_FLASHCTL_ATNR 0x00000000 /* Access == no retry */ 21162306a36Sopenharmony_ci#define AR5312_FLASHCTL_ATR 0x80000000 /* Access == retry every */ 21262306a36Sopenharmony_ci#define AR5312_FLASHCTL_ATR4 0xc0000000 /* Access == retry every 4 */ 21362306a36Sopenharmony_ci 21462306a36Sopenharmony_ci/* 21562306a36Sopenharmony_ci * ARM SDRAM Controller -- just enough to determine memory size 21662306a36Sopenharmony_ci */ 21762306a36Sopenharmony_ci#define AR5312_MEM_CFG1 0x0004 21862306a36Sopenharmony_ci 21962306a36Sopenharmony_ci#define AR5312_MEM_CFG1_AC0_M 0x00000700 /* bank 0: SDRAM addr check */ 22062306a36Sopenharmony_ci#define AR5312_MEM_CFG1_AC0_S 8 22162306a36Sopenharmony_ci#define AR5312_MEM_CFG1_AC1_M 0x00007000 /* bank 1: SDRAM addr check */ 22262306a36Sopenharmony_ci#define AR5312_MEM_CFG1_AC1_S 12 22362306a36Sopenharmony_ci 22462306a36Sopenharmony_ci#endif /* __ASM_MACH_ATH25_AR5312_REGS_H */ 225