]> git.karo-electronics.de Git - karo-tx-redboot.git/blob - packages/hal/arm/mxc91321/var/v2_0/include/hal_soc.h
c5e5e9900845e0c8ae2710cd75c6b0995e0fcd2e
[karo-tx-redboot.git] / packages / hal / arm / mxc91321 / var / v2_0 / include / hal_soc.h
1 //==========================================================================
2 //
3 //      hal_soc.h
4 //
5 //      SoC chip definitions
6 //
7 //==========================================================================
8 //####ECOSGPLCOPYRIGHTBEGIN####
9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12 // Copyright (C) 2002 Gary Thomas
13 //
14 // eCos is free software; you can redistribute it and/or modify it under
15 // the terms of the GNU General Public License as published by the Free
16 // Software Foundation; either version 2 or (at your option) any later version.
17 //
18 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
19 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
21 // for more details.
22 //
23 // You should have received a copy of the GNU General Public License along
24 // with eCos; if not, write to the Free Software Foundation, Inc.,
25 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26 //
27 // As a special exception, if other files instantiate templates or use macros
28 // or inline functions from this file, or you compile this file and link it
29 // with other works to produce a work based on this file, this file does not
30 // by itself cause the resulting work to be covered by the GNU General Public
31 // License. However the source code for this file must still be made available
32 // in accordance with section (3) of the GNU General Public License.
33 //
34 // This exception does not invalidate any other reasons why a work based on
35 // this file might be covered by the GNU General Public License.
36 //
37 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
38 // at http://sources.redhat.com/ecos/ecos-license/
39 // -------------------------------------------
40 //####ECOSGPLCOPYRIGHTEND####
41 //========================================================================*/
42
43 #ifndef __HAL_SOC_H__
44 #define __HAL_SOC_H__
45
46 #include <pkgconf/hal_arm_soc_specific_def.h>
47
48 #ifdef __ASSEMBLER__
49
50 #define REG8_VAL(a)          (a)
51 #define REG16_VAL(a)         (a)
52 #define REG32_VAL(a)         (a)
53
54 #define REG8_PTR(a)          (a)
55 #define REG16_PTR(a)         (a)
56 #define REG32_PTR(a)         (a)
57
58 #else /* __ASSEMBLER__ */
59
60 extern char HAL_PLATFORM_EXTRA[];
61 #define REG8_VAL(a)          ((unsigned char)(a))
62 #define REG16_VAL(a)         ((unsigned short)(a))
63 #define REG32_VAL(a)         ((unsigned int)(a))
64
65 #define REG8_PTR(a)          ((volatile unsigned char *)(a))
66 #define REG16_PTR(a)         ((volatile unsigned short *)(a))
67 #define REG32_PTR(a)         ((volatile unsigned int *)(a))
68 #define readb(a)             (*(volatile unsigned char *)(a))
69 #define readw(a)             (*(volatile unsigned short *)(a))
70 #define readl(a)             (*(volatile unsigned int *)(a))
71 #define writeb(v,a)          (*(volatile unsigned char *)(a) = (v))
72 #define writew(v,a)          (*(volatile unsigned short *)(a) = (v))
73 #define writel(v,a)          (*(volatile unsigned int *)(a) = (v))
74
75 #endif /* __ASSEMBLER__ */
76
77 /*
78  * Default Memory Layout Definitions
79  */
80
81 #define L2CC_BASE_ADDR          0x30000000
82
83 /*
84  * AIPS 1
85  */
86 #define AIPS1_BASE_ADDR         0x43F00000
87 #define AIPS1_CTRL_BASE_ADDR    AIPS1_BASE_ADDR
88 #define MAX_BASE_ADDR           0x43F04000
89 #define EVTMON_BASE_ADDR        0x43F08000
90 #define CLKCTL_BASE_ADDR        0x43F0C000
91 #define ETB_SLOT4_BASE_ADDR     0x43F10000
92 #define ETB_SLOT5_BASE_ADDR     0x43F14000
93 #define ECT_CTIO_BASE_ADDR      0x43F18000
94 #define I2C_BASE_ADDR           0x43F80000
95 #define MU_BASE_ADDR            0x43F84000
96 #define WDOG2_BASE_ADDR         0x43F88000
97 #define UART1_BASE_ADDR         0x43F90000
98 #define UART2_BASE_ADDR         0x43F94000
99 #define OWIRE_BASE_ADDR         0x43F9C000
100 #define SSI1_BASE_ADDR          0x43FA0000
101 #define CSPI1_BASE_ADDR         0x43FA4000
102 #define KPP_BASE_ADDR           0x43FA8000
103
104 /*
105  * SPBA
106  */
107 #define SPBA_BASE_ADDR          0x50000000
108 #if defined(CYGPKG_HAL_ARM_MXC91331_CHIP)
109 #define SIM2_BASE_ADDR          0x50000000
110 #elif defined(CYGPKG_HAL_ARM_MXC91321_CHIP)
111 #define IOMUXC_BASE_ADDR        0x50000000
112 #else
113 #error Neither MXC91321 nor MXC91331 defined. What is it?
114 #endif
115 #define MMC_SDHC1_BASE_ADDR     0x50004000
116 #define MMC_SDHC2_BASE_ADDR     0x50008000
117 #define UART3_BASE_ADDR         0x5000C000
118 #define CSPI2_BASE_ADDR         0x50010000
119 #define SSI2_BASE_ADDR          0x50014000
120 #define SIM1_BASE_ADDR          0x50018000
121 #define IIM_BASE_ADDR           0x5001C000
122 #define USBOTG_BASE_ADDR        0x50020000
123 #define HAC_BASE_ADDR           0x50024000
124 #define UART4_BASE_ADDR         0x50028000
125 #define GPIO2_BASE_ADDR         0x5002C000
126 #if defined(CYGPKG_HAL_ARM_MXC91331_CHIP)
127 #define IOMUXC_BASE_ADDR        0x50030000
128 #elif defined(CYGPKG_HAL_ARM_MXC91321_CHIP)
129 #define SIM2_BASE_ADDR          0x50000000
130 #endif
131 #define GEMK_BASE_ADDR          0x50034000
132 #define SDMA_CTI_BASE_ADDR      0x50038000
133 #define SPBA_CTRL_BASE_ADDR     0x5003C000
134
135 /*
136  * AIPS 2
137  */
138 #define AIPS2_BASE_ADDR         0x53F00000
139 #define AIPS2_CTRL_BASE_ADDR    AIPS2_BASE_ADDR
140 #define CRM_MCU_BASE_ADDR       0x53F80000
141 #define ECT_MCU_CTI_BASE_ADDR   0x53F84000
142 #define EDIO_BASE_ADDR          0x53F88000
143 #define FIRI_BASE_ADDR          0x53F8C000
144 #define GPT_BASE_ADDR           0x53F90000
145 #define EPIT1_BASE_ADDR         0x53F94000
146 #define EPIT2_BASE_ADDR         0x53F98000
147 #define SCC_BASE                0x53FAC000
148 #define RNG_BASE_ADDR           0x53FB0000
149 #define RTR_BASE_ADDR           0x53FB4000
150 #define IPU_CTRL_BASE_ADDR      0x53FC0000
151 #define AUDMUX_BASE             0x53FC4000
152 #define MPEG4_ENC_BASE          0x53FC8000
153 #define GPIO1_BASE_ADDR         0x53FCC000
154 #define SDMA_BASE_ADDR          0x53FD4000
155 #define RTC_BASE_ADDR           0x53FD8000
156 #define WDOG1_BASE_ADDR         0x53FDC000
157 #define WDOG_BASE_ADDR          WDOG1_BASE_ADDR
158 #define PWM_BASE_ADDR           0x53FE0000
159 #define RTIC_BASE_ADDR          0x53FEC000
160
161 /*
162  * ROMPATCH and AVIC
163  */
164 #define ROMPATCH_BASE_ADDR      0x60000000
165 #define AVIC_BASE_ADDR          0x68000000
166
167 /*
168  * NAND, SDRAM, WEIM, M3IF, EMI controllers
169  */
170 #define EXT_MEM_CTRL_BASE       0xB8000000
171 #define NFC_BASE                EXT_MEM_CTRL_BASE
172 #define ESDCTL_BASE             0xB8001000
173 #define WEIM_BASE_ADDR          0xB8002000
174 #define WEIM_CTRL_CS0           WEIM_BASE_ADDR
175 #define WEIM_CTRL_CS1           (WEIM_BASE_ADDR + 0x10)
176 #define WEIM_CTRL_CS2           (WEIM_BASE_ADDR + 0x20)
177 #define WEIM_CTRL_CS3           (WEIM_BASE_ADDR + 0x30)
178 #define WEIM_CTRL_CS4           (WEIM_BASE_ADDR + 0x40)
179 #define M3IF_BASE               0xB8003000
180 #define PCMCIA_CTL_BASE         0xB8004000
181
182 /*
183  * Memory regions and CS
184  */
185 #define IPU_MEM_BASE_ADDR       0x70000000
186 #define CSD0_BASE_ADDR          0x80000000
187 #define CSD1_BASE_ADDR          0x90000000
188 #define CS0_BASE_ADDR           0xA0000000
189 #define CS1_BASE_ADDR           0xA8000000
190 #define CS2_BASE_ADDR           0xB0000000
191 #define CS3_BASE_ADDR           0xB2000000
192 #define CS4_BASE_ADDR           0xB4000000
193 #define CS4_BASE_PSRAM          0xB5000000
194 #define CS5_BASE_ADDR           0xB6000000
195 #define PCMCIA_MEM_BASE_ADDR    0xC0000000
196
197 #define INTERNAL_ROM_VA         0xF0000000
198
199 /*
200  * IRQ Controller Register Definitions.
201  */
202 #define AVIC_NIMASK                     REG32_PTR(AVIC_BASE_ADDR + (0x04))
203 #define AVIC_INTTYPEH                   REG32_PTR(AVIC_BASE_ADDR + (0x18))
204 #define AVIC_INTTYPEL                   REG32_PTR(AVIC_BASE_ADDR + (0x1C))
205
206 /* L210 */
207 #define L2CC_BASE_ADDR                  0x30000000
208 #define L2_CACHE_LINE_SIZE              32
209 #define L2_CACHE_CTL_REG                0x100
210 #define L2_CACHE_AUX_CTL_REG            0x104
211 #define L2_CACHE_SYNC_REG               0x730
212 #define L2_CACHE_INV_LINE_REG           0x770
213 #define L2_CACHE_INV_WAY_REG            0x77C
214 #define L2_CACHE_CLEAN_LINE_REG         0x7B0
215 #define L2_CACHE_CLEAN_INV_LINE_REG     0x7F0
216
217 /* SPBA */
218 #define SPBA_IOMUX                      0x30
219 #define SPBA_GPIO_SDMA                  0x2C
220
221 /* CCM */
222 #define CLKCTL_MCR                      0x00
223 #define CLKCTL_PDR0                     0x04
224 #define CLKCTL_PDR1                     0x08
225 #define CLKCTL_RCSR                     0x0C
226 #define CLKCTL_MPCTL                    0x10
227 #define CLKCTL_UPCTL                    0x14
228 #define CLKCTL_COSR                     0x18
229 #define CLKCTL_MCGR0                    0x1C
230 #define CLKCTL_MCGR1                    0x20
231 #define CLKCTL_MCGR2                    0x24
232 #define CLKCTL_DCVR0                    0x28
233 #define CLKCTL_DCVR1                    0x2C
234 #define CLKCTL_DCVR2                    0x30
235 #define CLKCTL_DCVR3                    0x34
236 #define CLKCTL_PMCR                     0x38
237 #define CLKCTL_SDCR                     0x3C
238 #define CLKCTL_CDTR                     0x40
239 // The following is for MXC91321 only
240 #define CLKCTL_TPCTL                    0x44
241 #define CLKCTL_UCDTR                    0x48
242 #define CLKCTL_TCDTR                    0x4C
243 #define CLKCTL_MPDR2                    0x50
244 #define CLKCTL_DPTCDBG                  0x54
245 #define CLKCTL_PMCR1                    0x58
246
247 #define FREQ_26MHZ                      26000000
248 #define FREQ_32768HZ                    (32768 * 512)
249 #define FREQ_32000HZ                    (32000 * 512)
250 #define PLL_REF_CLK                     FREQ_26MHZ
251 //#define PLL_REF_CLK  FREQ_32768HZ
252 //#define PLL_REF_CLK  FREQ_32000HZ
253
254 /* WEIM - CS0 */
255 #define CSCRU                           0x00
256 #define CSCRL                           0x04
257 #define CSCRA                           0x08
258
259 /* ESDCTL */
260 #define ESDCTL_ESDCTL0                  0x00
261 #define ESDCTL_ESDCFG0                  0x04
262 #define ESDCTL_ESDCTL1                  0x08
263 #define ESDCTL_ESDCFG1                  0x0C
264 #define ESDCTL_ESDMISC                  0x10
265 #define ESDCTL_ESDCDLY1                 0x20
266 #define ESDCTL_ESDCDLY2                 0x24
267 #define ESDCTL_ESDCDLY5                 0x30
268 #define ESDCTL_ESDCDLYL                 0x34
269
270 #if (PLL_REF_CLK != 26000000)
271 #error Wrong PLL reference clock! The following macros will not work.
272 #endif
273
274 /* Assuming 26MHz input clock */
275 /* MPCTL                   PD             MFD              MFI          MFN */
276 #define MPCTL_PARAM_208  (((2-1) << 26) + ((1-1)  << 16) + (8  << 11) + (0  << 0))
277 #define MPCTL_PARAM_399  (((1-1) << 26) + ((52-1) << 16) + (7  << 11) + (35 << 0))
278 #define MPCTL_PARAM_532  (((1-1) << 26) + ((13-1) << 16) + (10 << 11) + (3 << 0))
279 #define TPCTL_PARAM_500  (((1-1) << 26) + ((208-1) << 16) + (9 << 11) + (123 << 0))
280 #define TPCTL_PARAM_532  MPCTL_PARAM_532
281
282 /* UPCTL                   PD             MFD              MFI          MFN */
283 #define UPCTL_PARAM_288  (((1-1) << 26) + ((13-1) << 16) + (5  << 10) + (7  << 0))
284                 
285 #define PDR0_399_133_66     0xFF800550  /* ARM=399MHz, HCLK=133MHz, IPG=66.5MHz */
286 #define PDR0_399_100_50     0xFF800458  /* ARM=399MHz, HCLK=100MHz, IPG=50MHz */
287 #define PDR0_399_66_66      0xFF800328  /* ARM=399MHz, HCLK=IPG=66.5MHz */
288 #define PDR0_52_52_52       0xFF80021C  /* ARM=HCLK=IPG=52MHz */
289 #define PDR0_208_52_52      0xFF800218  /* ARM=208MHz, HCLK=52MHz, IPG=52MHz */
290 #define PDR0_532_66_66      0xFF800338  /* ARM=532MHz, HCLK=66MHz, IPG=66MHz */
291 #define PDR0_532_133_66     0xFF800658  /* ARM=532MHz, HCLK=133MHz, IPG=66MHz */
292
293 /* IIM */
294 #define CHIP_REV_1_0        0x10      /* PASS 1.0 */
295 #define CHIP_REV_1_1        0x11      /* PASS 1.0 */
296 #define CHIP_REV_1_2        0x12      /* PASS 1.2 */
297 #define CHIP_REV_2_0        0x20      /* PASS 2.0 */
298 #define CHIP_REV_2_1        0x21      /* PASS 2.1 */
299 #if defined(CYGPKG_HAL_ARM_MXC91321_CHIP)
300 #define CHIP_LATEST         CHIP_REV_1_2
301 #else
302 #define CHIP_LATEST         CHIP_REV_2_1
303 #endif
304 #define IIM_STAT_OFF        0x00
305 #define IIM_STAT_BUSY       (1 << 7)
306 #define IIM_STAT_PRGD       (1 << 1)
307 #define IIM_STAT_SNSD       (1 << 0)
308 #define IIM_STATM_OFF       0x04
309 #define IIM_ERR_OFF         0x08
310 #define IIM_ERR_PRGE        (1 << 7)
311 #define IIM_ERR_WPE         (1 << 6)
312 #define IIM_ERR_OPE         (1 << 5)
313 #define IIM_ERR_RPE         (1 << 4)
314 #define IIM_ERR_WLRE        (1 << 3)
315 #define IIM_ERR_SNSE        (1 << 2)
316 #define IIM_ERR_PARITYE     (1 << 1)
317 #define IIM_EMASK_OFF       0x0C
318 #define IIM_FCTL_OFF        0x10
319 #define IIM_UA_OFF          0x14
320 #define IIM_LA_OFF          0x18
321 #define IIM_SDAT_OFF        0x1C
322 #define IIM_PREV_OFF        0x20
323 #define IIM_SREV_OFF        0x24
324 #define IIM_PREG_P_OFF      0x28
325 #define IIM_SCS0_OFF        0x2C
326 #define IIM_SCS1_P_OFF      0x30
327 #define IIM_SCS2_OFF        0x34
328 #define IIM_SCS3_P_OFF      0x38
329
330 #define EPIT_BASE_ADDR      EPIT1_BASE_ADDR
331 #define EPITCR              0x00
332 #define EPITSR              0x04
333 #define EPITLR              0x08
334 #define EPITCMPR            0x0C
335 #define EPITCNR             0x10
336
337 #define NAND_REG_BASE                   (NFC_BASE + 0xE00)
338 #define NFC_BUFSIZE_REG_OFF             (0 + 0x00)
339 #define RAM_BUFFER_ADDRESS_REG_OFF      (0 + 0x04)
340 #define NAND_FLASH_ADD_REG_OFF          (0 + 0x06)
341 #define NAND_FLASH_CMD_REG_OFF          (0 + 0x08)
342 #define NFC_CONFIGURATION_REG_OFF       (0 + 0x0A)
343 #define ECC_STATUS_RESULT_REG_OFF       (0 + 0x0C)
344 #define ECC_RSLT_MAIN_AREA_REG_OFF      (0 + 0x0E)
345 #define ECC_RSLT_SPARE_AREA_REG_OFF     (0 + 0x10)
346 #define NF_WR_PROT_REG_OFF              (0 + 0x12)
347 #define UNLOCK_START_BLK_ADD_REG_OFF    (0 + 0x14)
348 #define UNLOCK_END_BLK_ADD_REG_OFF      (0 + 0x16)
349 #define NAND_FLASH_WR_PR_ST_REG_OFF     (0 + 0x18)
350 #define NAND_FLASH_CONFIG1_REG_OFF      (0 + 0x1A)
351 #define NAND_FLASH_CONFIG2_REG_OFF      (0 + 0x1C)
352 #define RAM_BUFFER_ADDRESS_RBA_3        0x3
353 #define NFC_BUFSIZE_1KB                 0x0
354 #define NFC_BUFSIZE_2KB                 0x1
355 #define NFC_CONFIGURATION_UNLOCKED      0x2
356 #define ECC_STATUS_RESULT_NO_ERR        0x0
357 #define ECC_STATUS_RESULT_1BIT_ERR      0x1
358 #define ECC_STATUS_RESULT_2BIT_ERR      0x2
359 #define NF_WR_PROT_UNLOCK               0x4
360 #define NAND_FLASH_CONFIG1_FORCE_CE     (1 << 7)
361 #define NAND_FLASH_CONFIG1_RST          (1 << 6)
362 #define NAND_FLASH_CONFIG1_BIG          (1 << 5)
363 #define NAND_FLASH_CONFIG1_INT_MSK      (1 << 4)
364 #define NAND_FLASH_CONFIG1_ECC_EN       (1 << 3)
365 #define NAND_FLASH_CONFIG1_SP_EN        (1 << 2)
366 #define NAND_FLASH_CONFIG2_INT_DONE     (1 << 15)
367 #define NAND_FLASH_CONFIG2_FDO_PAGE     (0 << 3)
368 #define NAND_FLASH_CONFIG2_FDO_ID       (2 << 3)
369 #define NAND_FLASH_CONFIG2_FDO_STATUS   (4 << 3)
370 #define NAND_FLASH_CONFIG2_FDI_EN       (1 << 2)
371 #define NAND_FLASH_CONFIG2_FADD_EN      (1 << 1)
372 #define NAND_FLASH_CONFIG2_FCMD_EN      (1 << 0)
373 #define FDO_PAGE_SPARE_VAL              0x8
374
375 #define MXC_NAND_BASE_DUMMY             0xE0000000
376 #define NOR_FLASH_BOOT                  0
377 #define NAND_FLASH_BOOT                 0x10000000
378 #define SDRAM_NON_FLASH_BOOT            0x20000000
379 #define MXCBOOT_FLAG_REG                (AVIC_BASE_ADDR + 0x100)
380 #define MXCFIS_NOTHING                  0x00000000
381 #define MXCFIS_NAND                     0x10000000
382 #define MXCFIS_NOR                      0x20000000
383 #define MXCFIS_FLAG_REG                 (AVIC_BASE_ADDR + 0x104)
384
385 #define IS_BOOTING_FROM_NAND()          (readl(MXCBOOT_FLAG_REG) == NAND_FLASH_BOOT)
386 #define IS_BOOTING_FROM_NOR()           (readl(MXCBOOT_FLAG_REG) == NOR_FLASH_BOOT)
387 #define IS_BOOTING_FROM_SDRAM()         (readl(MXCBOOT_FLAG_REG) == SDRAM_NON_FLASH_BOOT)
388
389 #ifndef MXCFLASH_SELECT_NAND
390 #define IS_FIS_FROM_NAND()              0
391 #else
392 #define IS_FIS_FROM_NAND()              (readl(MXCFIS_FLAG_REG) == MXCFIS_NAND)
393 #endif
394
395 #ifndef MXCFLASH_SELECT_NOR
396 #define IS_FIS_FROM_NOR()               0
397 #else
398 #define IS_FIS_FROM_NOR()               (!IS_FIS_FROM_NAND())
399 #endif
400
401 #define MXC_ASSERT_NOR_BOOT()           writel(MXCFIS_NOR, MXCFIS_FLAG_REG)
402 #define MXC_ASSERT_NAND_BOOT()          writel(MXCFIS_NAND, MXCFIS_FLAG_REG)
403
404 /*
405  * This macro is used to get certain bit field from a number
406  */
407 #define MXC_GET_FIELD(val, len, sh)          ((val >> sh) & ((1 << len) - 1))
408
409 /*
410  * This macro is used to set certain bit field inside a number
411  */
412 #define MXC_SET_FIELD(val, len, sh, nval)    ((val & ~(((1 << len) - 1) << sh)) | (nval << sh))
413
414 #define UART_WIDTH_32         /* internal UART is 32bit access only */
415
416 #define L2CC_ENABLED
417
418 #if !defined(__ASSEMBLER__)
419 void cyg_hal_plf_serial_init(void);
420 void cyg_hal_plf_serial_stop(void);
421 void hal_delay_us(unsigned int usecs);
422 #define HAL_DELAY_US(n)     hal_delay_us(n)
423
424 enum plls {
425     MCU_PLL = CRM_MCU_BASE_ADDR + CLKCTL_MPCTL,
426     USB_PLL = CRM_MCU_BASE_ADDR + CLKCTL_UPCTL,
427     TUR_PLL = CRM_MCU_BASE_ADDR + CLKCTL_TPCTL,
428 };
429
430 enum main_clocks {
431     CPU_CLK,
432     AHB_CLK,
433     IPG_CLK,
434     NFC_CLK,
435     USB_CLK,
436 };
437
438 enum peri_clocks {
439     UART1_BAUD,
440     UART2_BAUD,
441     UART3_BAUD,
442     UART4_BAUD,
443     SSI1_BAUD,
444     SSI2_BAUD,
445     CSI_BAUD,
446     FIRI_BAUD,
447     SPI1_CLK = CSPI1_BASE_ADDR,
448     SPI2_CLK = CSPI2_BASE_ADDR,
449 };
450
451 unsigned int pll_clock(enum plls pll);
452
453 unsigned int get_main_clock(enum main_clocks clk);
454
455 unsigned int get_peri_clock(enum peri_clocks clk);
456
457 enum {
458     MXC_NFC_V1,
459     MXC_NFC_V2,
460 };
461
462 typedef unsigned int nfc_setup_func_t(unsigned int, unsigned int, unsigned int);
463
464 #endif //#if !defined(__ASSEMBLER__)
465
466 #define HAL_MMU_OFF() \
467 CYG_MACRO_START          \
468     asm volatile (                                                      \
469         "mcr p15, 0, r0, c7, c14, 0;"                                   \
470         "mcr p15, 0, r0, c7, c10, 4;" /* drain the write buffer */      \
471         "mcr p15, 0, r0, c7, c5, 0;" /* invalidate I cache */           \
472         "mrc p15, 0, r0, c1, c0, 0;" /* read c1 */                      \
473         "bic r0, r0, #0x7;" /* disable DCache and MMU */                \
474         "bic r0, r0, #0x1000;" /* disable ICache */                     \
475         "mcr p15, 0, r0, c1, c0, 0;" /*  */                             \
476         "nop;" /* flush i+d-TLBs */                                     \
477         "nop;" /* flush i+d-TLBs */                                     \
478         "nop;" /* flush i+d-TLBs */                                     \
479         "nop;" /* flush i+d-TLBs */                                     \
480         "nop;" /* flush i+d-TLBs */                                     \
481         "nop;" /* flush i+d-TLBs */                                     \
482         "nop;" /* flush i+d-TLBs */                                     \
483         "nop;" /* flush i+d-TLBs */                                     \
484         "nop;" /* flush i+d-TLBs */                                     \
485         :                                                               \
486         :                                                               \
487         : "r0","memory" /* clobber list */);                            \
488 CYG_MACRO_END
489
490 #endif // __HAL_SOC_H__