blob: ca10b97ebe630c74c87971601b3c8f1a56cdd1ec [file] [log] [blame]
Mian Yousaf Kaukabb1b22612010-05-01 21:46:35 +02001/*
Rabin Vincent6af8a132010-03-30 12:46:38 +05302 * Copyright (C) 2009 ST-Ericsson SA
Mian Yousaf Kaukabb1b22612010-05-01 21:46:35 +02003 *
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 Vincentede0ee72009-11-16 16:52:35 +053018 * macro to get at IO space when running virtually
Mian Yousaf Kaukabb1b22612010-05-01 21:46:35 +020019 */
Rabin Vincentede0ee72009-11-16 16:52:35 +053020#define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + IO_BASE)
Rabin Vincent926aa122010-03-01 11:04:51 +053021#define __io_address(n) __io(IO_ADDRESS(n))
22#define io_p2v(n) __io_address(n)
Rabin Vincentede0ee72009-11-16 16:52:35 +053023
Rabin Vincentf5cc84a2010-03-09 11:06:14 +053024#include <mach/db8500-regs.h>
25#include <mach/db5500-regs.h>
Martin Persson6acc0622010-02-10 08:47:11 +010026
Rabin Vincentdcf660e2010-03-05 09:56:07 +053027#ifdef CONFIG_UX500_SOC_DB8500
Rabin Vincentf5cc84a2010-03-09 11:06:14 +053028#define UX500(periph) U8500_##periph##_BASE
Rabin Vincentdcf660e2010-03-05 09:56:07 +053029#elif defined(CONFIG_UX500_SOC_DB5500)
Rabin Vincentf5cc84a2010-03-09 11:06:14 +053030#define UX500(periph) U5500_##periph##_BASE
Martin Persson6acc0622010-02-10 08:47:11 +010031#endif
Mian Yousaf Kaukabb1b22612010-05-01 21:46:35 +020032
Rabin Vincentf5cc84a2010-03-09 11:06:14 +053033#define UX500_BACKUPRAM0_BASE UX500(BACKUPRAM0)
34#define UX500_BACKUPRAM1_BASE UX500(BACKUPRAM1)
35#define UX500_B2R2_BASE UX500(B2R2)
Martin Persson6acc0622010-02-10 08:47:11 +010036
Rabin Vincentf5cc84a2010-03-09 11:06:14 +053037#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 Kaukabb1b22612010-05-01 21:46:35 +020042
Rabin Vincentf5cc84a2010-03-09 11:06:14 +053043#define UX500_DMA_BASE UX500(DMA)
44#define UX500_FSMC_BASE UX500(FSMC)
Mian Yousaf Kaukabb1b22612010-05-01 21:46:35 +020045
Rabin Vincentf5cc84a2010-03-09 11:06:14 +053046#define UX500_GIC_CPU_BASE UX500(GIC_CPU)
47#define UX500_GIC_DIST_BASE UX500(GIC_DIST)
Mian Yousaf Kaukabb1b22612010-05-01 21:46:35 +020048
Rabin Vincentf5cc84a2010-03-09 11:06:14 +053049#define UX500_I2C1_BASE UX500(I2C1)
50#define UX500_I2C2_BASE UX500(I2C2)
51#define UX500_I2C3_BASE UX500(I2C3)
Mian Yousaf Kaukabb1b22612010-05-01 21:46:35 +020052
Rabin Vincentf5cc84a2010-03-09 11:06:14 +053053#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 Vincentede0ee72009-11-16 16:52:35 +053058
Rabin Vincentf5cc84a2010-03-09 11:06:14 +053059#define UX500_RNG_BASE UX500(RNG)
Joakim Bech528d6a62010-04-15 14:07:13 +020060#define UX500_HASH0_BASE UX500(HASH0)
61#define UX500_HASH1_BASE UX500(HASH1)
Rabin Vincentf5cc84a2010-03-09 11:06:14 +053062#define UX500_RTC_BASE UX500(RTC)
Mian Yousaf Kaukabb1b22612010-05-01 21:46:35 +020063
Rabin Vincentf5cc84a2010-03-09 11:06:14 +053064#define UX500_SCU_BASE UX500(SCU)
Mian Yousaf Kaukabb1b22612010-05-01 21:46:35 +020065
Rabin Vincentf5cc84a2010-03-09 11:06:14 +053066#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 Vincentdcf660e2010-03-05 09:56:07 +053071
Rabin Vincentf5cc84a2010-03-09 11:06:14 +053072#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 Vincentdcf660e2010-03-05 09:56:07 +053076
Rabin Vincentf5cc84a2010-03-09 11:06:14 +053077#define UX500_SIA_BASE UX500(SIA)
78#define UX500_SVA_BASE UX500(SVA)
Mian Yousaf Kaukabb1b22612010-05-01 21:46:35 +020079
Rabin Vincentf5cc84a2010-03-09 11:06:14 +053080#define UX500_TWD_BASE UX500(TWD)
Mian Yousaf Kaukabb1b22612010-05-01 21:46:35 +020081
Rabin Vincentf5cc84a2010-03-09 11:06:14 +053082#define UX500_UART0_BASE UX500(UART0)
83#define UX500_UART1_BASE UX500(UART1)
84#define UX500_UART2_BASE UX500(UART2)
Mian Yousaf Kaukabb1b22612010-05-01 21:46:35 +020085
Rabin Vincentf5cc84a2010-03-09 11:06:14 +053086#define UX500_USBOTG_BASE UX500(USBOTG)
Mian Yousaf Kaukabb1b22612010-05-01 21:46:35 +020087
psenf3758d82010-05-06 20:00:59 +053088#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 Kaukabb1b22612010-05-01 21:46:35 +020095
psenf3758d82010-05-06 20:00:59 +053096#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 Kaukabb1b22612010-05-01 21:46:35 +020098
Mian Yousaf Kaukabb1b22612010-05-01 21:46:35 +020099/* 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 Kaukabb1b22612010-05-01 21:46:35 +0200115#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 Vincent2567df22009-11-16 16:59:02 +0530159#define I2C4_LP_OWNADDR 0x90
Mian Yousaf Kaukabb1b22612010-05-01 21:46:35 +0200160
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 Rubin1453f822010-05-27 15:25:41 +0200167#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 Chen1b7470b2010-06-15 17:27:11 +0200172/* 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 Persson7e1b55b2010-02-11 13:00:23 +0100181
Rabin Vincentbf3ed412010-03-05 13:49:24 +0530182#ifndef __ASSEMBLY__
183
184#include <asm/cputype.h>
185
186/* TODO: dynamic detection */
187static 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
196static inline bool cpu_is_u8500ed(void)
197{
Rabin Vincent942fcce2010-03-08 19:33:47 +0530198#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 Vincentbf3ed412010-03-05 13:49:24 +0530208 return cpu_is_u8500() && ((read_cpuid_id() & 15) == 0);
Rabin Vincent942fcce2010-03-08 19:33:47 +0530209#endif
Rabin Vincentbf3ed412010-03-05 13:49:24 +0530210}
211
212static inline bool cpu_is_u8500v1(void)
213{
Rabin Vincent942fcce2010-03-08 19:33:47 +0530214#ifdef CONFIG_MACH_U8500_SIMULATOR
215 /* See comment in cpu_is_u8500ed() */
216 return cpu_is_u8500();
217#else
Rabin Vincentbf3ed412010-03-05 13:49:24 +0530218 return cpu_is_u8500() && ((read_cpuid_id() & 15) == 1);
Rabin Vincent942fcce2010-03-08 19:33:47 +0530219#endif
Rabin Vincentbf3ed412010-03-05 13:49:24 +0530220}
221
Rabin Vincent5afe14a2010-04-08 11:29:57 +0530222#ifdef CONFIG_UX500_SOC_DB8500
223extern bool cpu_is_u8500v11(void);
224#else
225static inline bool cpu_is_u8500v11(void) { return 0; }
226#endif
227
Rabin Vincentbf3ed412010-03-05 13:49:24 +0530228static 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 Vincente815d292010-03-09 10:13:48 +0530237/* Deprecated, don't use in new code. Just call cpu_is_u8500ed() directly. */
238static inline int u8500_is_earlydrop(void)
239{
240 return cpu_is_u8500ed();
241}
242
Rabin Vincentbf3ed412010-03-05 13:49:24 +0530243#endif
244
Mian Yousaf Kaukabb1b22612010-05-01 21:46:35 +0200245#endif /* __ASM_ARCH_HARDWARE_H */