1213498Scognet/*- 2213498Scognet * Copyright (c) 2010 Greg Ansley. All rights reserved. 3213498Scognet * 4213498Scognet * Redistribution and use in source and binary forms, with or without 5213498Scognet * modification, are permitted provided that the following conditions 6213498Scognet * are met: 7213498Scognet * 1. Redistributions of source code must retain the above copyright 8213498Scognet * notice, this list of conditions and the following disclaimer. 9213498Scognet * 2. Redistributions in binary form must reproduce the above copyright 10213498Scognet * notice, this list of conditions and the following disclaimer in the 11213498Scognet * documentation and/or other materials provided with the distribution. 12213498Scognet * 13213498Scognet * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14213498Scognet * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15213498Scognet * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16213498Scognet * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 17213498Scognet * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18213498Scognet * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19213498Scognet * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20213498Scognet * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21213498Scognet * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22213498Scognet * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23213498Scognet * SUCH DAMAGE. 24213498Scognet */ 25213498Scognet 26213498Scognet/* $FreeBSD: releng/10.2/sys/arm/at91/at91sam9260reg.h 266110 2014-05-15 02:41:23Z ian $ */ 27213498Scognet 28213498Scognet#ifndef AT91SAM9260REG_H_ 29213498Scognet#define AT91SAM9260REG_H_ 30213498Scognet 31213498Scognet/* Chip Specific limits */ 32213498Scognet#define SAM9260_PLL_A_MIN_IN_FREQ 1000000 /* 1 Mhz */ 33213498Scognet#define SAM9260_PLL_A_MAX_IN_FREQ 32000000 /* 32 Mhz */ 34213498Scognet#define SAM9260_PLL_A_MIN_OUT_FREQ 80000000 /* 80 Mhz */ 35213498Scognet#define SAM9260_PLL_A_MAX_OUT_FREQ 240000000 /* 240 Mhz */ 36213498Scognet#define SAM9260_PLL_A_MUL_SHIFT 16 37236989Simp#define SAM9260_PLL_A_MUL_MASK 0x3FF 38213498Scognet#define SAM9260_PLL_A_DIV_SHIFT 0 39236989Simp#define SAM9260_PLL_A_DIV_MASK 0xFF 40213498Scognet 41213498Scognet#define SAM9260_PLL_B_MIN_IN_FREQ 1000000 /* 1 Mhz */ 42213498Scognet#define SAM9260_PLL_B_MAX_IN_FREQ 5000000 /* 5 Mhz */ 43213498Scognet#define SAM9260_PLL_B_MIN_OUT_FREQ 70000000 /* 70 Mhz */ 44213498Scognet#define SAM9260_PLL_B_MAX_OUT_FREQ 130000000 /* 130 Mhz */ 45213498Scognet#define SAM9260_PLL_B_MUL_SHIFT 16 46213498Scognet#define SAM9260_PLL_B_MUL_MASK 0x3FF 47213498Scognet#define SAM9260_PLL_B_DIV_SHIFT 0 48236989Simp#define SAM9260_PLL_B_DIV_MASK 0xFF 49213498Scognet 50236989Simp/* 51213498Scognet * Memory map, from datasheet : 52213498Scognet * 0x00000000 - 0x0ffffffff : Internal Memories 53213498Scognet * 0x10000000 - 0x1ffffffff : Chip Select 0 54213498Scognet * 0x20000000 - 0x2ffffffff : Chip Select 1 55213498Scognet * 0x30000000 - 0x3ffffffff : Chip Select 2 56213498Scognet * 0x40000000 - 0x4ffffffff : Chip Select 3 57213498Scognet * 0x50000000 - 0x5ffffffff : Chip Select 4 58213498Scognet * 0x60000000 - 0x6ffffffff : Chip Select 5 59213498Scognet * 0x70000000 - 0x7ffffffff : Chip Select 6 60213498Scognet * 0x80000000 - 0x8ffffffff : Chip Select 7 61213498Scognet * 0x90000000 - 0xeffffffff : Undefined (Abort) 62213498Scognet * 0xf0000000 - 0xfffffffff : Peripherals 63213498Scognet */ 64213498Scognet 65213498Scognet#define AT91_CHIPSELECT_0 0x10000000 66213498Scognet#define AT91_CHIPSELECT_1 0x20000000 67213498Scognet#define AT91_CHIPSELECT_2 0x30000000 68213498Scognet#define AT91_CHIPSELECT_3 0x40000000 69213498Scognet#define AT91_CHIPSELECT_4 0x50000000 70213498Scognet#define AT91_CHIPSELECT_5 0x60000000 71213498Scognet#define AT91_CHIPSELECT_6 0x70000000 72213498Scognet#define AT91_CHIPSELECT_7 0x80000000 73213498Scognet 74213498Scognet 75213498Scognet#define AT91SAM9260_EMAC_BASE 0xffc4000 76213498Scognet#define AT91SAM9260_EMAC_SIZE 0x4000 77213498Scognet 78213498Scognet#define AT91SAM9260_RSTC_BASE 0xffffd00 79213498Scognet#define AT91SAM9260_RSTC_SIZE 0x10 80213498Scognet 81213498Scognet#define RSTC_CR 0 82213498Scognet#define RSTC_PROCRST (1 << 0) 83213498Scognet#define RSTC_PERRST (1 << 2) 84213498Scognet#define RSTC_KEY (0xa5 << 24) 85213498Scognet 86213498Scognet/* USART*/ 87213498Scognet 88213498Scognet#define AT91SAM9260_USART_SIZE 0x4000 89213498Scognet#define AT91SAM9260_USART0_BASE 0xffb0000 90213498Scognet#define AT91SAM9260_USART0_PDC 0xffb0100 91213498Scognet#define AT91SAM9260_USART0_SIZE AT91SAM9260_USART_SIZE 92213498Scognet#define AT91SAM9260_USART1_BASE 0xffb4000 93213498Scognet#define AT91SAM9260_USART1_PDC 0xffb4100 94213498Scognet#define AT91SAM9260_USART1_SIZE AT91SAM9260_USART_SIZE 95213498Scognet#define AT91SAM9260_USART2_BASE 0xffb8000 96213498Scognet#define AT91SAM9260_USART2_PDC 0xffb8100 97213498Scognet#define AT91SAM9260_USART2_SIZE AT91SAM9260_USART_SIZE 98213498Scognet#define AT91SAM9260_USART3_BASE 0xffd0000 99213498Scognet#define AT91SAM9260_USART3_PDC 0xffd0100 100213498Scognet#define AT91SAM9260_USART3_SIZE AT91SAM9260_USART_SIZE 101213498Scognet#define AT91SAM9260_USART4_BASE 0xffd4000 102213498Scognet#define AT91SAM9260_USART4_PDC 0xffd4100 103213498Scognet#define AT91SAM9260_USART4_SIZE AT91SAM9260_USART_SIZE 104213498Scognet#define AT91SAM9260_USART5_BASE 0xffd8000 105213498Scognet#define AT91SAM9260_USART5_PDC 0xffd8100 106213498Scognet#define AT91SAM9260_USART5_SIZE AT91SAM9260_USART_SIZE 107213498Scognet 108213498Scognet/*TC*/ 109213498Scognet#define AT91SAM9260_TC0_BASE 0xffa0000 110213498Scognet#define AT91SAM9260_TC0_SIZE 0x4000 111213498Scognet#define AT91SAM9260_TC0C0_BASE 0xffa0000 112213498Scognet#define AT91SAM9260_TC0C1_BASE 0xffa0040 113213498Scognet#define AT91SAM9260_TC0C2_BASE 0xffa0080 114213498Scognet 115213498Scognet#define AT91SAM9260_TC1_BASE 0xffdc000 116213498Scognet#define AT91SAM9260_TC1_SIZE 0x4000 117213498Scognet 118213498Scognet/*SPI*/ 119213498Scognet 120213498Scognet#define AT91SAM9260_SPI0_BASE 0xffc8000 121213498Scognet 122213498Scognet#define AT91SAM9260_SPI0_SIZE 0x4000 123213498Scognet#define AT91SAM9260_IRQ_SPI0 12 124213498Scognet 125213498Scognet#define AT91SAM9260_SPI1_BASE 0xffcc000 126213498Scognet#define AT91SAM9260_SPI1_SIZE 0x4000 127213498Scognet#define AT91SAM9260_IRQ_SPI1 13 128213498Scognet 129213498Scognet/* System Registers */ 130213498Scognet#define AT91SAM9260_SYS_BASE 0xffff000 131213498Scognet#define AT91SAM9260_SYS_SIZE 0x1000 132213498Scognet 133213498Scognet#define AT91SAM9260_MATRIX_BASE 0xfffee00 134213498Scognet#define AT91SAM9260_MATRIX_SIZE 0x1000 135213498Scognet#define AT91SAM9260_EBICSA 0x011C 136213498Scognet 137213498Scognet#define AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA (1 << 3) 138213498Scognet 139213498Scognet#define AT91SAM9260_DBGU_BASE 0xffff200 140213498Scognet#define AT91SAM9260_DBGU_SIZE 0x200 141213498Scognet 142213498Scognet/* 143213498Scognet * PIO 144213498Scognet */ 145213498Scognet#define AT91SAM9260_PIOA_BASE 0xffff400 146213498Scognet#define AT91SAM9260_PIOA_SIZE 0x200 147213498Scognet#define AT91SAM9260_PIOB_BASE 0xffff600 148213498Scognet#define AT91SAM9260_PIOB_SIZE 0x200 149213498Scognet#define AT91SAM9260_PIOC_BASE 0xffff800 150213498Scognet#define AT91SAM9260_PIOC_SIZE 0x200 151213498Scognet 152213498Scognet#define AT91RM92_PMC_BASE 0xffffc00 153213498Scognet#define AT91RM92_PMC_SIZE 0x100 154213498Scognet/* IRQs : */ 155213498Scognet/* 156236989Simp * 0: AIC 157213498Scognet * 1: System peripheral (System timer, RTC, DBGU) 158213498Scognet * 2: PIO Controller A 159213498Scognet * 3: PIO Controller B 160213498Scognet * 4: PIO Controller C 161213498Scognet * 5: ADC 162213498Scognet * 6: USART 0 163213498Scognet * 7: USART 1 164213498Scognet * 8: USART 2 165213498Scognet * 9: MMC Interface 166213498Scognet * 10: USB device port 167213498Scognet * 11: Two-wirte interface 168213498Scognet * 12: SPI 0 169213498Scognet * 13: SPI 1 170213498Scognet * 14: SSC 171213498Scognet * 15: - (reserved) 172213498Scognet * 16: - (reserved) 173213498Scognet * 17: Timer Counter 0 174213498Scognet * 18: Timer Counter 1 175213498Scognet * 19: Timer Counter 2 176213498Scognet * 20: USB Host port 177213498Scognet * 21: EMAC 178213498Scognet * 22: ISI 179213498Scognet * 23: USART 3 180213498Scognet * 24: USART 4 181213498Scognet * 25: USART 2 182213498Scognet * 26: Timer Counter 3 183213498Scognet * 27: Timer Counter 4 184213498Scognet * 28: Timer Counter 5 185213498Scognet * 29: AIC IRQ0 186213498Scognet * 30: AIC IRQ1 187213498Scognet * 31: AIC IRQ2 188213498Scognet */ 189213498Scognet 190213498Scognet#define AT91SAM9260_IRQ_SYSTEM 1 191213498Scognet#define AT91SAM9260_IRQ_PIOA 2 192213498Scognet#define AT91SAM9260_IRQ_PIOB 3 193213498Scognet#define AT91SAM9260_IRQ_PIOC 4 194213498Scognet#define AT91SAM9260_IRQ_USART0 6 195213498Scognet#define AT91SAM9260_IRQ_USART1 7 196213498Scognet#define AT91SAM9260_IRQ_USART2 8 197213498Scognet#define AT91SAM9260_IRQ_MCI 9 198213498Scognet#define AT91SAM9260_IRQ_UDP 10 199213498Scognet#define AT91SAM9260_IRQ_TWI 11 200213498Scognet#define AT91SAM9260_IRQ_SPI0 12 201213498Scognet#define AT91SAM9260_IRQ_SPI1 13 202213498Scognet#define AT91SAM9260_IRQ_SSC0 14 203213498Scognet#define AT91SAM9260_IRQ_SSC1 15 204213498Scognet#define AT91SAM9260_IRQ_SSC2 16 205213498Scognet#define AT91SAM9260_IRQ_TC0 17 206213498Scognet#define AT91SAM9260_IRQ_TC1 18 207213498Scognet#define AT91SAM9260_IRQ_TC2 19 208213498Scognet#define AT91SAM9260_IRQ_UHP 20 209213498Scognet#define AT91SAM9260_IRQ_EMAC 21 210213498Scognet#define AT91SAM9260_IRQ_USART3 23 211213498Scognet#define AT91SAM9260_IRQ_USART4 24 212213498Scognet#define AT91SAM9260_IRQ_USART5 25 213213498Scognet#define AT91SAM9260_IRQ_AICBASE 29 214213498Scognet 215213498Scognet/* Alias */ 216213498Scognet#define AT91SAM9260_IRQ_DBGU AT91SAM9260_IRQ_SYSTEM 217213498Scognet#define AT91SAM9260_IRQ_PMC AT91SAM9260_IRQ_SYSTEM 218213498Scognet#define AT91SAM9260_IRQ_WDT AT91SAM9260_IRQ_SYSTEM 219213498Scognet#define AT91SAM9260_IRQ_PIT AT91SAM9260_IRQ_SYSTEM 220213498Scognet#define AT91SAM9260_IRQ_RSTC AT91SAM9260_IRQ_SYSTEM 221213498Scognet#define AT91SAM9260_IRQ_OHCI AT91SAM9260_IRQ_UHP 222213498Scognet#define AT91SAM9260_IRQ_NAND (-1) 223213498Scognet 224213498Scognet#define AT91SAM9260_AIC_BASE 0xffff000 225213498Scognet#define AT91SAM9260_AIC_SIZE 0x200 226213498Scognet 227213498Scognet/* Timer */ 228213498Scognet 229213498Scognet#define AT91SAM9260_WDT_BASE 0xffffd40 230213498Scognet#define AT91SAM9260_WDT_SIZE 0x10 231213498Scognet 232213498Scognet#define AT91SAM9260_PIT_BASE 0xffffd30 233213498Scognet#define AT91SAM9260_PIT_SIZE 10 234213498Scognet 235213498Scognet#define AT91SAM9260_SMC_BASE 0xfffec00 236213498Scognet#define AT91SAM9260_SMC_SIZE 0x200 237213498Scognet 238213498Scognet#define AT91SAM9260_PMC_BASE 0xffffc00 239213498Scognet#define AT91SAM9260_PMC_SIZE 0x100 240213498Scognet 241213498Scognet#define AT91SAM9260_UDP_BASE 0xffa4000 242213498Scognet#define AT91SAM9260_UDP_SIZE 0x4000 243213498Scognet 244213498Scognet#define AT91SAM9260_MCI_BASE 0xffa8000 245213498Scognet#define AT91SAM9260_MCI_SIZE 0x4000 246213498Scognet 247213498Scognet#define AT91SAM9260_TWI_BASE 0xffaC000 248213498Scognet#define AT91SAM9260_TWI_SIZE 0x4000 249213498Scognet 250213498Scognet/* XXX Needs to be carfully coordinated with 251213498Scognet * other * soc's so phyical and vm address 252213498Scognet * mapping are unique. XXX 253213498Scognet */ 254266110Sian#define AT91SAM9260_OHCI_VA_BASE 0xdfc00000 255266110Sian#define AT91SAM9260_OHCI_BASE 0x00500000 256213498Scognet#define AT91SAM9260_OHCI_SIZE 0x00100000 257213498Scognet 258266110Sian#define AT91SAM9260_NAND_VA_BASE 0xe0000000 259266110Sian#define AT91SAM9260_NAND_BASE 0x40000000 260213498Scognet#define AT91SAM9260_NAND_SIZE 0x10000000 261213498Scognet 262213498Scognet 263213498Scognet/* SDRAMC */ 264213498Scognet#define AT91SAM9260_SDRAMC_BASE 0xfffea00 265213498Scognet#define AT91SAM9260_SDRAMC_MR 0x00 266213498Scognet#define AT91SAM9260_SDRAMC_MR_MODE_NORMAL 0 267213498Scognet#define AT91SAM9260_SDRAMC_MR_MODE_NOP 1 268213498Scognet#define AT91SAM9260_SDRAMC_MR_MODE_PRECHARGE 2 269213498Scognet#define AT91SAM9260_SDRAMC_MR_MODE_LOAD_MODE_REGISTER 3 270213498Scognet#define AT91SAM9260_SDRAMC_MR_MODE_REFRESH 4 271213498Scognet#define AT91SAM9260_SDRAMC_TR 0x04 272213498Scognet#define AT91SAM9260_SDRAMC_CR 0x08 273213498Scognet#define AT91SAM9260_SDRAMC_CR_NC_8 0x0 274213498Scognet#define AT91SAM9260_SDRAMC_CR_NC_9 0x1 275213498Scognet#define AT91SAM9260_SDRAMC_CR_NC_10 0x2 276213498Scognet#define AT91SAM9260_SDRAMC_CR_NC_11 0x3 277213498Scognet#define AT91SAM9260_SDRAMC_CR_NC_MASK 0x00000003 278213498Scognet#define AT91SAM9260_SDRAMC_CR_NR_11 0x0 279213498Scognet#define AT91SAM9260_SDRAMC_CR_NR_12 0x4 280213498Scognet#define AT91SAM9260_SDRAMC_CR_NR_13 0x8 281213498Scognet#define AT91SAM9260_SDRAMC_CR_NR_RES 0xc 282213498Scognet#define AT91SAM9260_SDRAMC_CR_NR_MASK 0x0000000c 283213498Scognet#define AT91SAM9260_SDRAMC_CR_NB_2 0x00 284213498Scognet#define AT91SAM9260_SDRAMC_CR_NB_4 0x10 285213498Scognet#define AT91SAM9260_SDRAMC_CR_DBW_16 0x80 286213498Scognet#define AT91SAM9260_SDRAMC_CR_NB_MASK 0x00000010 287213498Scognet#define AT91SAM9260_SDRAMC_CR_NCAS_MASK 0x00000060 288213498Scognet#define AT91SAM9260_SDRAMC_CR_TWR_MASK 0x00000780 289213498Scognet#define AT91SAM9260_SDRAMC_CR_TRC_MASK 0x00007800 290213498Scognet#define AT91SAM9260_SDRAMC_CR_TRP_MASK 0x00078000 291213498Scognet#define AT91SAM9260_SDRAMC_CR_TRCD_MASK 0x00780000 292213498Scognet#define AT91SAM9260_SDRAMC_CR_TRAS_MASK 0x07800000 293213498Scognet#define AT91SAM9260_SDRAMC_CR_TXSR_MASK 0x78000000 294213498Scognet#define AT91SAM9260_SDRAMC_HSR 0x0c 295213498Scognet#define AT91SAM9260_SDRAMC_LPR 0x10 296213498Scognet#define AT91SAM9260_SDRAMC_IER 0x14 297213498Scognet#define AT91SAM9260_SDRAMC_IDR 0x18 298213498Scognet#define AT91SAM9260_SDRAMC_IMR 0x1c 299213498Scognet#define AT91SAM9260_SDRAMC_ISR 0x20 300213498Scognet#define AT91SAM9260_SDRAMC_MDR 0x24 301213498Scognet 302213498Scognet#endif /* AT91SAM9260REG_H_*/ 303213498Scognet 304