2 * (C) Copyright 2009 Freescale Semiconductor, Inc.
4 * See file CREDITS for list of people who contributed to this
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 #include <asm/arch/mx51.h>
25 .macro do_wait_op_done
26 1: ldr r7, [r3, #0x2C]
27 ands r7, r7, #0x80000000
31 .endm // do_wait_op_done
33 .section ".text.load", "x"
36 * R0: NFC BUF base address
37 * R1: NFC BUF data end address
38 * R2: RAM destination offset address
39 * R3: NFC IP control register base
40 * R4: NAND block address
41 * R5: RAM destination end address
42 * R6: NFC DATA register base
43 * R7 - r14: 8 working buffer registers
46 ldr r0, =NFC_BASE_ADDR_AXI
47 add r1, r0, #NFC_BUF_SIZE
49 /* For non-nand-boot, directly quit */
56 /* Get NAND page size */
57 ldr r3, =NFC_BASE_ADDR
63 adrls r5, NFC_PAGE_MODE
65 /* Get actually pre-loading size*/
69 /* r1 ~ r3, r12, lr(r14) must not change in relocated operation */
70 ldr r2, U_BOOT_NAND_START
71 1: ldmia r0!, {r5-r11, r13}
72 stmia r2!, {r5-r11, r13}
77 ldr r5, U_BOOT_NAND_START
90 adr r0, SAVE_REGS /* Save r12 & R14(lr) */
94 ldr r0, =NFC_BASE_ADDR_AXI
97 ldr r5, =_end /* Try get right image size */
98 add r5, r2, #0x00040000 /* Fixme to get actual image size */
101 add r7, r7, #0x00FF0000
112 1: add r9, r7, r8, lsr #3
120 ldr r7, NFC_PAGE_MODE
122 /* start_nfc_addr_ops1(pg_no, pg_off) */
124 movgt r7, r4, lsr #12 /* Get the page number for 4K page */
125 moveq r7, r4, lsr #11 /* Get the page number for 2K page */
127 str r7, [r6, #0x04] /* Set the address */
129 /* writel((FLASH_Read_Mode1_LG << 8) | FLASH_Read_Mode1, NAND_CMD_REG)*/
133 /* writel(0x00000000, NAND_CONFIGURATION1_REG) */
138 * writel(NAND_LAUNCH_AUTO_READ, NAND_LAUNCH_REG);
146 1: ldmia r0!, {r7-r14}
152 ldr r7, NFC_PAGE_MODE
154 ldr r0, =NFC_BASE_ADDR_AXI
163 U_BOOT_NAND_START: .word TEXT_BASE
164 CONST_0X0FFF: .word 0x0FFF
165 NFC_PAGE_MODE: .word 0x1000