Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 1 | /* |
Rabin Vincent | 6af8a13 | 2010-03-30 12:46:38 +0530 | [diff] [blame] | 2 | * Copyright (C) 2009 ST-Ericsson SA |
Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 3 | * |
| 4 | * U8500 hardware definitions |
| 5 | * |
| 6 | * This file is licensed under the terms of the GNU General Public |
| 7 | * License version 2. This program is licensed "as is" without any |
| 8 | * warranty of any kind, whether express or implied. |
| 9 | */ |
| 10 | #ifndef __ASM_ARCH_HARDWARE_H |
| 11 | #define __ASM_ARCH_HARDWARE_H |
| 12 | |
| 13 | #define IO_BASE 0xF0000000 /* VA of IO */ |
| 14 | #define IO_SIZE 0x1FF00000 /* VA Size for IO */ |
| 15 | #define IO_START 0x10100000 /* PA of IO */ |
| 16 | |
| 17 | /* |
Rabin Vincent | ede0ee7 | 2009-11-16 16:52:35 +0530 | [diff] [blame] | 18 | * macro to get at IO space when running virtually |
Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 19 | */ |
Rabin Vincent | ede0ee7 | 2009-11-16 16:52:35 +0530 | [diff] [blame] | 20 | #define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + IO_BASE) |
Rabin Vincent | 926aa12 | 2010-03-01 11:04:51 +0530 | [diff] [blame] | 21 | #define __io_address(n) __io(IO_ADDRESS(n)) |
| 22 | #define io_p2v(n) __io_address(n) |
Rabin Vincent | ede0ee7 | 2009-11-16 16:52:35 +0530 | [diff] [blame] | 23 | |
Rabin Vincent | f5cc84a | 2010-03-09 11:06:14 +0530 | [diff] [blame] | 24 | #include <mach/db8500-regs.h> |
| 25 | #include <mach/db5500-regs.h> |
Martin Persson | 6acc062 | 2010-02-10 08:47:11 +0100 | [diff] [blame] | 26 | |
Rabin Vincent | dcf660e | 2010-03-05 09:56:07 +0530 | [diff] [blame] | 27 | #ifdef CONFIG_UX500_SOC_DB8500 |
Rabin Vincent | f5cc84a | 2010-03-09 11:06:14 +0530 | [diff] [blame] | 28 | #define UX500(periph) U8500_##periph##_BASE |
Rabin Vincent | dcf660e | 2010-03-05 09:56:07 +0530 | [diff] [blame] | 29 | #elif defined(CONFIG_UX500_SOC_DB5500) |
Rabin Vincent | f5cc84a | 2010-03-09 11:06:14 +0530 | [diff] [blame] | 30 | #define UX500(periph) U5500_##periph##_BASE |
Martin Persson | 6acc062 | 2010-02-10 08:47:11 +0100 | [diff] [blame] | 31 | #endif |
Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 32 | |
Rabin Vincent | f5cc84a | 2010-03-09 11:06:14 +0530 | [diff] [blame] | 33 | #define UX500_BACKUPRAM0_BASE UX500(BACKUPRAM0) |
| 34 | #define UX500_BACKUPRAM1_BASE UX500(BACKUPRAM1) |
| 35 | #define UX500_B2R2_BASE UX500(B2R2) |
Martin Persson | 6acc062 | 2010-02-10 08:47:11 +0100 | [diff] [blame] | 36 | |
Rabin Vincent | f5cc84a | 2010-03-09 11:06:14 +0530 | [diff] [blame] | 37 | #define UX500_CLKRST1_BASE UX500(CLKRST1) |
| 38 | #define UX500_CLKRST2_BASE UX500(CLKRST2) |
| 39 | #define UX500_CLKRST3_BASE UX500(CLKRST3) |
| 40 | #define UX500_CLKRST5_BASE UX500(CLKRST5) |
| 41 | #define UX500_CLKRST6_BASE UX500(CLKRST6) |
Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 42 | |
Rabin Vincent | f5cc84a | 2010-03-09 11:06:14 +0530 | [diff] [blame] | 43 | #define UX500_DMA_BASE UX500(DMA) |
| 44 | #define UX500_FSMC_BASE UX500(FSMC) |
Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 45 | |
Rabin Vincent | f5cc84a | 2010-03-09 11:06:14 +0530 | [diff] [blame] | 46 | #define UX500_GIC_CPU_BASE UX500(GIC_CPU) |
| 47 | #define UX500_GIC_DIST_BASE UX500(GIC_DIST) |
Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 48 | |
Rabin Vincent | f5cc84a | 2010-03-09 11:06:14 +0530 | [diff] [blame] | 49 | #define UX500_I2C1_BASE UX500(I2C1) |
| 50 | #define UX500_I2C2_BASE UX500(I2C2) |
| 51 | #define UX500_I2C3_BASE UX500(I2C3) |
Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 52 | |
Rabin Vincent | f5cc84a | 2010-03-09 11:06:14 +0530 | [diff] [blame] | 53 | #define UX500_L2CC_BASE UX500(L2CC) |
| 54 | #define UX500_MCDE_BASE UX500(MCDE) |
| 55 | #define UX500_MTU0_BASE UX500(MTU0) |
| 56 | #define UX500_MTU1_BASE UX500(MTU1) |
| 57 | #define UX500_PRCMU_BASE UX500(PRCMU) |
Rabin Vincent | ede0ee7 | 2009-11-16 16:52:35 +0530 | [diff] [blame] | 58 | |
Rabin Vincent | f5cc84a | 2010-03-09 11:06:14 +0530 | [diff] [blame] | 59 | #define UX500_RNG_BASE UX500(RNG) |
Joakim Bech | 528d6a6 | 2010-04-15 14:07:13 +0200 | [diff] [blame] | 60 | #define UX500_HASH0_BASE UX500(HASH0) |
| 61 | #define UX500_HASH1_BASE UX500(HASH1) |
Rabin Vincent | f5cc84a | 2010-03-09 11:06:14 +0530 | [diff] [blame] | 62 | #define UX500_RTC_BASE UX500(RTC) |
Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 63 | |
Rabin Vincent | f5cc84a | 2010-03-09 11:06:14 +0530 | [diff] [blame] | 64 | #define UX500_SCU_BASE UX500(SCU) |
Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 65 | |
Rabin Vincent | f5cc84a | 2010-03-09 11:06:14 +0530 | [diff] [blame] | 66 | #define UX500_SDI0_BASE UX500(SDI0) |
| 67 | #define UX500_SDI1_BASE UX500(SDI1) |
| 68 | #define UX500_SDI2_BASE UX500(SDI2) |
| 69 | #define UX500_SDI3_BASE UX500(SDI3) |
| 70 | #define UX500_SDI4_BASE UX500(SDI4) |
Rabin Vincent | dcf660e | 2010-03-05 09:56:07 +0530 | [diff] [blame] | 71 | |
Rabin Vincent | f5cc84a | 2010-03-09 11:06:14 +0530 | [diff] [blame] | 72 | #define UX500_SPI0_BASE UX500(SPI0) |
| 73 | #define UX500_SPI1_BASE UX500(SPI1) |
| 74 | #define UX500_SPI2_BASE UX500(SPI2) |
| 75 | #define UX500_SPI3_BASE UX500(SPI3) |
Rabin Vincent | dcf660e | 2010-03-05 09:56:07 +0530 | [diff] [blame] | 76 | |
Rabin Vincent | f5cc84a | 2010-03-09 11:06:14 +0530 | [diff] [blame] | 77 | #define UX500_SIA_BASE UX500(SIA) |
| 78 | #define UX500_SVA_BASE UX500(SVA) |
Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 79 | |
Rabin Vincent | f5cc84a | 2010-03-09 11:06:14 +0530 | [diff] [blame] | 80 | #define UX500_TWD_BASE UX500(TWD) |
Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 81 | |
Rabin Vincent | f5cc84a | 2010-03-09 11:06:14 +0530 | [diff] [blame] | 82 | #define UX500_UART0_BASE UX500(UART0) |
| 83 | #define UX500_UART1_BASE UX500(UART1) |
| 84 | #define UX500_UART2_BASE UX500(UART2) |
Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 85 | |
Rabin Vincent | f5cc84a | 2010-03-09 11:06:14 +0530 | [diff] [blame] | 86 | #define UX500_USBOTG_BASE UX500(USBOTG) |
Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 87 | |
psen | f3758d8 | 2010-05-06 20:00:59 +0530 | [diff] [blame] | 88 | #define U8500_ESRAM_BASE 0x40000000 |
| 89 | /* on ED this register is secure so leaving mem init value |
| 90 | will not conflict with MCDE driver as on ED MCDE is using bank 6 */ |
| 91 | #define U8500_ESRAM_DMA_LCPA_OFFSET_ED 0x84000 |
| 92 | /* on V1 DMA uses 4KB for logical parameters |
| 93 | position is right after the 64KB reserved for security */ |
| 94 | #define U8500_ESRAM_DMA_LCPA_OFFSET 0x10000 |
Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 95 | |
psen | f3758d8 | 2010-05-06 20:00:59 +0530 | [diff] [blame] | 96 | #define U8500_DMA_LCPA_BASE (U8500_ESRAM_BASE + U8500_ESRAM_DMA_LCPA_OFFSET) |
| 97 | #define U8500_DMA_LCPA_BASE_ED (U8500_ESRAM_BASE + U8500_ESRAM_DMA_LCPA_OFFSET_ED) |
Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 98 | |
Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 99 | /* SSP specific declaration */ |
| 100 | #define SSP_PER_ID 0x01080022 |
| 101 | #define SSP_PER_MASK 0x0fffffff |
| 102 | |
| 103 | /* SSP specific declaration */ |
| 104 | #define SPI_PER_ID 0x00080023 |
| 105 | #define SPI_PER_MASK 0x0fffffff |
| 106 | |
| 107 | /* MSP specific declaration */ |
| 108 | #define MSP_PER_ID 0x00280021 |
| 109 | #define MSP_PER_MASK 0x00ffffff |
| 110 | |
| 111 | /* DMA specific declaration */ |
| 112 | #define DMA_PER_ID 0x8A280080 |
| 113 | #define DMA_PER_MASK 0xffffffff |
| 114 | |
Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 115 | #define GPIO_PER_ID 0x1f380060 |
| 116 | #define GPIO_PER_MASK 0xffffffff |
| 117 | |
| 118 | /* RTC specific declaration */ |
| 119 | #define RTC_PER_ID 0x00280031 |
| 120 | #define RTC_PER_MASK 0x00ffffff |
| 121 | |
| 122 | /* |
| 123 | * FIFO offsets for IPs |
| 124 | */ |
| 125 | #define I2C_TX_REG_OFFSET (0x10) |
| 126 | #define I2C_RX_REG_OFFSET (0x18) |
| 127 | #define UART_TX_RX_REG_OFFSET (0) |
| 128 | #define MSP_TX_RX_REG_OFFSET (0) |
| 129 | #define SSP_TX_RX_REG_OFFSET (0x8) |
| 130 | #define SPI_TX_RX_REG_OFFSET (0x8) |
| 131 | #define SD_MMC_TX_RX_REG_OFFSET (0x80) |
| 132 | |
| 133 | #define MSP_0_CONTROLLER 1 |
| 134 | #define MSP_1_CONTROLLER 2 |
| 135 | #define MSP_2_CONTROLLER 3 |
| 136 | |
| 137 | #define SSP_0_CONTROLLER 4 |
| 138 | #define SSP_1_CONTROLLER 5 |
| 139 | |
| 140 | #define SPI023_0_CONTROLLER 6 |
| 141 | #define SPI023_1_CONTROLLER 7 |
| 142 | #define SPI023_2_CONTROLLER 8 |
| 143 | #define SPI023_3_CONTROLLER 9 |
| 144 | |
| 145 | /* MSP related board specific declaration************************/ |
| 146 | |
| 147 | #define MSP_DATA_DELAY MSP_DELAY_0 |
| 148 | #define MSP_TX_CLOCK_EDGE MSP_FALLING_EDGE |
| 149 | #define MSP_RX_CLOCK_EDGE MSP_FALLING_EDGE |
| 150 | #define NUM_MSP_CONTROLLER 3 |
| 151 | |
| 152 | /* I2C configuration |
| 153 | * * * |
| 154 | * * */ |
| 155 | #define I2C0_LP_OWNADDR 0x31 |
| 156 | #define I2C1_LP_OWNADDR 0x60 |
| 157 | #define I2C2_LP_OWNADDR 0x70 |
| 158 | #define I2C3_LP_OWNADDR 0x80 |
Rabin Vincent | 2567df2 | 2009-11-16 16:59:02 +0530 | [diff] [blame] | 159 | #define I2C4_LP_OWNADDR 0x90 |
Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 160 | |
| 161 | /* SDMMC specific declarations */ |
| 162 | #define SDI_PER_ID 0x00480180 |
| 163 | #define SDI_PER_MASK 0x00ffffff |
| 164 | /* B2R2 clock management register */ |
| 165 | #define PRCM_B2R2CLK_MGT_REG 0x80157078 /** B2R2 clock selection */ |
| 166 | |
Jimmy Rubin | 1453f82 | 2010-05-27 15:25:41 +0200 | [diff] [blame] | 167 | #define U8500_DSI_LINK1_BASE 0xA0351000 |
| 168 | #define U8500_DSI_LINK_SIZE 0x1000 |
| 169 | #define U8500_DSI_LINK_COUNT 0x3 |
| 170 | #define U8500_DSI_LINK2_BASE (U8500_DSI_LINK1_BASE + U8500_DSI_LINK_SIZE) |
| 171 | #define U8500_DSI_LINK3_BASE (U8500_DSI_LINK2_BASE + U8500_DSI_LINK_SIZE) |
Shujuan Chen | 1b7470b | 2010-06-15 17:27:11 +0200 | [diff] [blame] | 172 | /* ACCCON secure base address */ |
| 173 | |
| 174 | #define ACCCON_BASE_SEC (0xBFFF0000) |
| 175 | /* ACCCON normal world base address */ |
| 176 | #define ACCCON_BASE (0xBFFF1000) |
| 177 | /* ACCCON register for CPU reset jump address */ |
| 178 | #define ACCCON_CPUVEC_RESET_ADDR_OFFSET (0x00000020) |
| 179 | /* ACCCON register for CPU reset */ |
| 180 | #define ACCCON_ACC_CPU_CTRL_OFFSET (0x000000BC) |
Per Persson | 7e1b55b | 2010-02-11 13:00:23 +0100 | [diff] [blame] | 181 | |
Rabin Vincent | bf3ed41 | 2010-03-05 13:49:24 +0530 | [diff] [blame] | 182 | #ifndef __ASSEMBLY__ |
| 183 | |
| 184 | #include <asm/cputype.h> |
| 185 | |
| 186 | /* TODO: dynamic detection */ |
| 187 | static inline bool cpu_is_u8500(void) |
| 188 | { |
| 189 | #ifdef CONFIG_UX500_SOC_DB8500 |
| 190 | return 1; |
| 191 | #else |
| 192 | return 0; |
| 193 | #endif |
| 194 | } |
| 195 | |
| 196 | static inline bool cpu_is_u8500ed(void) |
| 197 | { |
Rabin Vincent | 942fcce | 2010-03-08 19:33:47 +0530 | [diff] [blame] | 198 | #ifdef CONFIG_MACH_U8500_SIMULATOR |
| 199 | /* |
| 200 | * SVP8500v1 unfortunately does not implement the changed MIDR register |
| 201 | * on v1, but instead maintains the old ED revision. |
| 202 | * |
| 203 | * So we hardcode this assuming that only SVP8500v1 is supported. If |
| 204 | * SVP8500ed is required, another Kconfig option will have to be added. |
| 205 | */ |
| 206 | return 0; |
| 207 | #else |
Rabin Vincent | bf3ed41 | 2010-03-05 13:49:24 +0530 | [diff] [blame] | 208 | return cpu_is_u8500() && ((read_cpuid_id() & 15) == 0); |
Rabin Vincent | 942fcce | 2010-03-08 19:33:47 +0530 | [diff] [blame] | 209 | #endif |
Rabin Vincent | bf3ed41 | 2010-03-05 13:49:24 +0530 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | static inline bool cpu_is_u8500v1(void) |
| 213 | { |
Rabin Vincent | 942fcce | 2010-03-08 19:33:47 +0530 | [diff] [blame] | 214 | #ifdef CONFIG_MACH_U8500_SIMULATOR |
| 215 | /* See comment in cpu_is_u8500ed() */ |
| 216 | return cpu_is_u8500(); |
| 217 | #else |
Rabin Vincent | bf3ed41 | 2010-03-05 13:49:24 +0530 | [diff] [blame] | 218 | return cpu_is_u8500() && ((read_cpuid_id() & 15) == 1); |
Rabin Vincent | 942fcce | 2010-03-08 19:33:47 +0530 | [diff] [blame] | 219 | #endif |
Rabin Vincent | bf3ed41 | 2010-03-05 13:49:24 +0530 | [diff] [blame] | 220 | } |
| 221 | |
Rabin Vincent | 5afe14a | 2010-04-08 11:29:57 +0530 | [diff] [blame] | 222 | #ifdef CONFIG_UX500_SOC_DB8500 |
| 223 | extern bool cpu_is_u8500v11(void); |
| 224 | #else |
| 225 | static inline bool cpu_is_u8500v11(void) { return 0; } |
| 226 | #endif |
| 227 | |
Rabin Vincent | bf3ed41 | 2010-03-05 13:49:24 +0530 | [diff] [blame] | 228 | static inline bool cpu_is_u5500(void) |
| 229 | { |
| 230 | #ifdef CONFIG_UX500_SOC_DB5500 |
| 231 | return 1; |
| 232 | #else |
| 233 | return 0; |
| 234 | #endif |
| 235 | } |
| 236 | |
Rabin Vincent | e815d29 | 2010-03-09 10:13:48 +0530 | [diff] [blame] | 237 | /* Deprecated, don't use in new code. Just call cpu_is_u8500ed() directly. */ |
| 238 | static inline int u8500_is_earlydrop(void) |
| 239 | { |
| 240 | return cpu_is_u8500ed(); |
| 241 | } |
| 242 | |
Rabin Vincent | bf3ed41 | 2010-03-05 13:49:24 +0530 | [diff] [blame] | 243 | #endif |
| 244 | |
Mian Yousaf Kaukab | b1b2261 | 2010-05-01 21:46:35 +0200 | [diff] [blame] | 245 | #endif /* __ASM_ARCH_HARDWARE_H */ |